primitives
primitives copied to clipboard
Allow indeterminate state for DropdownMenu CheckboxItem
Feature request
Overview
The Checkbox primitive allows for three states via [data-state]
: checked, unchecked, and indeterminate. However, the DropdownMenu's CheckboxItem appears to only allow two states: checked and unchecked. I'd love to see parity between these two, as I have a need to create a checkbox with an indeterminate state within a dropdown.
It seems I'll need to fall back to using a Checkbox instead of a CheckboxItem in this case, though I'm not clear yet on what all the ramifications of doing so may be.
Examples in other libraries
N/A
Who does this impact? Who is this for?
This impacts any user looking for feature parity between the Checkbox and DropdownMenu.CheckboxItem primitives. :)
Additional context
That's it, pretty simple! Thanks for the consideration!
Hi @colepeters,
I agree with you parity makes sense here and a quick search shows that the menuitemcheckbox
aria role supports mixed
state for "indeterminate" checkbox items.
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemcheckbox_role
I will add this as an enhancement. If you feel like contributing, that could be an easy one to work on as there's the reference work from checkbox itself and MenuItemCheckbox
is only controlled anyway, I think it should be pretty easy.
Thanks @benoitgrelard! I may have some time for this over the next week or two, so I'll see if I can take a stab at it. :)