Toggle buttons (active/pressed state) #7757
Labels
proposal: accepted
This request has gone through triaging and we are accepting PR's against it.
type: enhancement 💡
Summary
Buttons should allow for an active/pressed state to indicate a feature/function/option is turned on or off, effectively working as a toggle.
Justification
A big use case for this is for icon-only buttons, for example to indicate text formatting, sidepanel statuses or options:
Examples
Keynote
Sketch
VSCode
Slack
Spotify
"Must have" functionality
A prop for the button component (like
active
,toggled
,pressed
or something like this) to enable and disable the respective styling.The
aria-pressed
attribute must be set accordingly (https://www.w3.org/TR/wai-aria-practices-1.1/#button, https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/button_role#toggle_buttons)Available extra resources
Quick exploration with the text toolbar pattern:
From other libraries:
I could submit a PR for this if the proposal is approved and the visual specification / color token to use is defined.
The text was updated successfully, but these errors were encountered: