width of the widget
in my dashboard that extends ListRecords I'm using the getHeaderWidgets function which returns an array
$widgets = [
SurveysSentWidget::make(['stats' => $stats['surveysSent']]),
];
to display a custom widget.
the code of my widget is this
<?php
namespace Modules\MyModule\Filament\Widgets;
use Filament\Forms;
use Filament\Widgets\Widgets;
class SurveysSentWidget extends Widget implements Forms\Contracts\HasForms
{
use Forms\Concerns\InteractsWithForms;
protected static string $view = 'my_module::filament.widgets.stats';
public ?float $tot = null;
public ?float $sms = null;
public ?float $emails = null;
public ?string $title = 'Surveys Posted';
public array $stats;
/**
* @var int | string | array<string, int | null>
*/
protected int|string|array $columnSpan = '2xl';
public function mount(): void
{
$this->tot = $this->stats['tot'][0] ?? 0;
$this->sms = $this->stats['sms'][0] ?? 0;
$this->emails = $this->stats['emails'][0] ?? 0;
}
}
unfortunately, despite having changed the columnSpan property, the widget still does not change its width, always taking half the width of my page.
Where am I doing wrong?
0 Replies