MonkeyPhill
MonkeyPhill
FFilament
Created by MonkeyPhill on 12/31/2024 in #❓┊help
Select Divider/Separator (<hr>)
Do you know how well option borders are supported by browsers? I tried targeting an empty value, which the developer tools seem to think has worked, but I can't see any border.
option[value=""] {
border-bottom: 1px solid black;
}
option[value=""] {
border-bottom: 1px solid black;
}
29 replies
FFilament
Created by MonkeyPhill on 12/31/2024 in #❓┊help
Select Divider/Separator (<hr>)
It seems that Radio has the same issues as ToggleButtons - if I change option-3 above to Radio then the null option is not selected on load but does save if chosen. I can explore mutating the null option to another value. If I want to use Radio or ToggleButtons for an enum value then I will also need to convert the enum into an options list by hand so that I can add the null value ahead of it. It seems a lot of work for something that the select does quite easily with a placeholder.
29 replies
FFilament
Created by MonkeyPhill on 12/31/2024 in #❓┊help
Select Divider/Separator (<hr>)
Components\ToggleButtons::make('option-1')
->boolean(), // pretty, but does not handle null
Components\ToggleButtons::make('option-2')
->boolean()
->nullable(), // exactly the same as option-1
Components\ToggleButtons::make('option-3')
->options([
null => 'Default (On)', // saves, but is not selected on load
true => 'On', // may need to add colors & icons
false => 'Off',
]),
Components\ToggleButtons::make('option-4')
// pretty; handles labels, colors and icons from enum class;
// but does not handle null and cannot be deselected.
->options(CommentNotificationOption::class),
Components\ToggleButtons::make('option-1')
->boolean(), // pretty, but does not handle null
Components\ToggleButtons::make('option-2')
->boolean()
->nullable(), // exactly the same as option-1
Components\ToggleButtons::make('option-3')
->options([
null => 'Default (On)', // saves, but is not selected on load
true => 'On', // may need to add colors & icons
false => 'Off',
]),
Components\ToggleButtons::make('option-4')
// pretty; handles labels, colors and icons from enum class;
// but does not handle null and cannot be deselected.
->options(CommentNotificationOption::class),
29 replies
FFilament
Created by MonkeyPhill on 12/31/2024 in #❓┊help
Select Divider/Separator (<hr>)
Since I asked this question I ended up using a select and setting the placeholder text for my 'Default' option so that I could move on for a bit. This seemed to make sense since default value is actually null; the On/Off options are nullable booleans; and anything else is a nullable string BackedEnum. Toggle buttons handle booleans and enums really well, but they don't have any way for me to handle null. If I write out the options by hand, including a null option, it doesn't get shown as selected when the form is loaded (but it does save ok). It also loses the magic enum handling (HasLabel, HasColor, HasIcon). Am I missing something? Is there a way to deselect a toggle button, or handle null values?
29 replies
FFilament
Created by MonkeyPhill on 12/31/2024 in #❓┊help
Select Divider/Separator (<hr>)
Thank you for pointing out the support for hr - I didn’t realise how poor it was in some places.
29 replies
FFilament
Created by MonkeyPhill on 12/31/2024 in #❓┊help
Select Divider/Separator (<hr>)
This particular option has 3 states, so a single checkbox or toggle wouldn’t work. Radio, select or similar. In the same form, I have options with more than 2 non-default options too which I would prefer to be visually similar.
29 replies
FFilament
Created by MonkeyPhill on 12/31/2024 in #❓┊help
Select Divider/Separator (<hr>)
Thanks, I'll give it a go and see how I feel when I click around with it. I feel I'd probably still prefer a real <hr> if I could get it.
29 replies
FFilament
Created by MonkeyPhill on 12/31/2024 in #❓┊help
Select Divider/Separator (<hr>)
I don’t know why I’m not getting notifications here, so sorry for my slow reply. The screenshot I shared initially has a blank entry above the <hr> which is unpleasant and unhelpful, which is because it is wrapped in an <option>. I would like a way to add the divider without the option. A disabled option with a bunch of -‘s isn’t as pretty (or semantic), but it may have to do the job.
29 replies
FFilament
Created by MonkeyPhill on 12/31/2024 in #❓┊help
Select Divider/Separator (<hr>)
Thanks - the grouping works, but it provides a heading rather than a divider. I just want a better way to distinguish a default or current value from all the others.
29 replies