Open jhbrown94 opened 5 years ago
Interesting!
I think for your given usecase you probably just need to specify a custom icon
, which keys off of some other state than just the Bool
. Something like:
...
icon = always (allSomeOrNoneIcon model.selected)
onChange
can still communicate something meaningful to your update
True
-> select everythingFalse
-> deselect everythingFair point. Although I'm not sure the onChange
argument is useful once I'm storing state in model.selected; onClick
is all I really need at that point and I can derive my next state from my current one. At which point, maybe I should just use a button
? But I worry that it won't style exactly like the checkbox
even if I use the same icons...?
It's common in a list UI to have a checkbox at the top with three possible states -- None selected ( ), All selected (✓), or some selected (-). If Checkbox was parameterized on the datatype, the
icon
function could return a type-specific icon permitting this use case, along with other future cases requiring even more states. Something like this: