MonkeyPhill
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
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
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
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