F
Filament10mo ago
Omid

Why can't you set the state of Toggle Buttons?

This does not work, tried several different ways to set the toggle button value
ToggleButtons::make('test')
->options([1,2,3,4])
->default(1),
ToggleButtons::make('test')
->options([1,2,3,4])
->default(1),
Solution:
Is it on an Edit page? ->default() is for creation only.
Jump to solution
3 Replies
Solution
Dennis Koch
Dennis Koch10mo ago
Is it on an Edit page? ->default() is for creation only.
Dennis Koch
Dennis Koch10mo ago
See the docs: https://filamentphp.com/docs/3.x/forms/fields/getting-started#setting-a-default-value
Note that these defaults are only used when the form is loaded without existing data. Inside panel resources this only works on Create Pages, as Edit Pages will always fill the data from the model.
Omid
OmidOP10mo ago
Ahh oke, yes it is. And also in a repeater
Want results from more Discord servers?
Add your server