DEV Community

Cover image for Filament Up to Date #2: ToggleButtons Get size() and fullWidth()
Andréia Bohner
Andréia Bohner

Posted on

Filament Up to Date #2: ToggleButtons Get size() and fullWidth()

Second tip in the Filament Up to Date series: ToggleButtons got two new methods.

size()

Sets the size to small, medium, or large. You can also pass a closure. The default is medium.

use Filament\Forms\Components\ToggleButtons;
use Filament\Support\Enums\Size;

ToggleButtons::make('status')
    ->options(OrderStatus::class)
    ->size(Size::Large);
Enter fullscreen mode Exit fullscreen mode

fullWidth()

Stretches the toggle buttons across the full width of the field. It works with stacked, grouped, and inline layouts.

ToggleButtons::make('status')
    ->options(OrderStatus::class)
    ->fullWidth();
Enter fullscreen mode Exit fullscreen mode

When to use them

  • size() fits dense forms (small) or touch-friendly screens (large).
  • fullWidth() suits a status selector that should line up with the other fields in your form.

Filament Up To Date Tip #2

Pull requests

Thanks @getupkid (PR #20517) and @caseydwyer (PR #20520) for contributing this! 🙌


📚 All tips in this series: devdeia.com/filament-up-to-date

Top comments (0)