FilamentF
Filament3y ago
Veur

Show different widgets in 1 row

Hi, in the header of a View page I would like to display 3 widgets: 1 'normal' widget and 2 Stat widgets (see screenshot).
Is there a way to display them next to each other, in 1 row?

This is the getHeaderWidgets() method currently:

    public function getHeaderWidgets(): array
    {
        return [
            NormalWidget::class,
            StatsWidgets::class,
        ];
    }
Schermafbeelding_2023-11-08_om_13.59.09.png
Solution
try edit the columnSpan property of the widget
for example
// ViewResource.php
    public function getHeaderWidgetsColumns(): int|string|array
    {
        return 3;
    }

// NormalWidget.php
    protected int | string | array $columnSpan = 1;

// StatsWidgets.php
    protected int | string | array $columnSpan = 2;

    protected function getColumns(): int
    {
        return 2;
    }
image.png
Was this page helpful?