F
Filamentβ€’2y ago
techenby

Customize Widget height instead of width

Is it possible to define a widget's height instead of width? i.e. tell a widget to span 2 rows instead of one? https://filamentphp.com/docs/2.x/admin/dashboard/getting-started#customizing-widget-width
Filament
Getting started - Dashboard - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
5 Replies
LeandroFerreira
LeandroFerreiraβ€’2y ago
Did you try
protected static ?string $maxHeight = '300px';
protected static ?string $maxHeight = '300px';
?
techenby
techenbyOPβ€’2y ago
I hadn't but that does not appear to change anything. I don't really care what the height is in pixels though, I just want to tell a widget how many rows to span.
techenby
techenbyOPβ€’2y ago
LeandroFerreira
LeandroFerreiraβ€’2y ago
hum, I don't know
techenby
techenbyOPβ€’2y ago
TBH my guess is no, but I thought I'd ask πŸ™‚ I solved it by creating an override for the view:
class QueuedLinks extends BaseWidget
{
protected static ?int $sort = 2;

protected static string $view = 'filament.widgets.queued-links';
class QueuedLinks extends BaseWidget
{
protected static ?int $sort = 2;

protected static string $view = 'filament.widgets.queued-links';
<x-filament::widget class="filament-widgets-table-widget row-span-2 h-full">
{{ $this->table }}
</x-filament::widget>
<x-filament::widget class="filament-widgets-table-widget row-span-2 h-full">
{{ $this->table }}
</x-filament::widget>
Since I don't have a custom theme, I also needed to add a css file with:
.row-span-2 {
grid-row: span 2 / span 2;
}
.row-span-2 {
grid-row: span 2 / span 2;
}
And tell filament about it:
Filament::registerStyles([
url('/assets/css/filament-extras.css'),
]);
Filament::registerStyles([
url('/assets/css/filament-extras.css'),
]);
Want results from more Discord servers?
Add your server