Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggle buttons (active/pressed state) #7757

Closed
Tracked by #7860
janhassel opened this issue Feb 8, 2021 · 4 comments
Closed
Tracked by #7860

Toggle buttons (active/pressed state) #7757

janhassel opened this issue Feb 8, 2021 · 4 comments
Assignees
Labels
proposal: accepted This request has gone through triaging and we are accepting PR's against it. type: enhancement 💡

Comments

@janhassel
Copy link
Member

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
image

Sketch
image

VSCode
image

Slack
image

Spotify
image

"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:
image

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.

@tw15egan tw15egan added proposal: open This request has gone through triaging. We're determining whether we take this on or not. and removed status: needs triage 🕵️‍♀️ labels Feb 8, 2021
@tw15egan
Copy link
Member

tw15egan commented Feb 8, 2021

cc @carbon-design-system/design

@aagonzales
Copy link
Member

Yup, I think this is something we would want to add either to the icon only ghost button or as a new component.

There is also an issue open for icon only content switcher #6982

@tw15egan tw15egan added proposal: accepted This request has gone through triaging and we are accepting PR's against it. and removed proposal: open This request has gone through triaging. We're determining whether we take this on or not. labels Feb 11, 2021
@tw15egan tw15egan self-assigned this Feb 11, 2021
@mjabbink
Copy link

Totally think we should add this.

@tw15egan
Copy link
Member

Closing as resolved with #7900 and #7784. Feel free to reopen if we need to take any more action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal: accepted This request has gone through triaging and we are accepting PR's against it. type: enhancement 💡
Projects
None yet
Development

No branches or pull requests

4 participants