All States
Includes all applicable states (hover, focus, disabled, etc...)
An interactive visual element that indicates an available action for the user.
Defining shared language for discussing the construction and structure of this component.
Key |
Category |
Parts |
---|---|---|
1 |
Shape |
Border radius, border color |
2 |
Shape |
Background color |
3 |
Shape |
Padding (block [top, bottom], inline [left, right]) |
4 |
Text |
Font family, size/line height, color |
Storybook (previews work best on Firefox)
Buttons are for making a change to page state, submitting, or initiating an action.
Figma library (internal only)
HCM library (internal only)
Acorn offers 3 button types in 2 sizes, with 5 states across 3 modes (themes).
Acorn has 2 sizes for buttons, default and small.
Small buttons are only used for smaller UI surfaces. e.g. Infobar
Only Regular (Secondary) and Primary buttons may use the small size.
Available states are as follows: default, hover, active, focus, and disabled.
The focus and disabled states have important caveats that apply across types and modes.
Focus
:focus states are used for keyboard navigation and sometimes when clicking a focus-able element using a mouse. Focus states are vital for accessibility and may not be omitted.
The CSS pseudo class :focus does not affect visual output in iOS or Android.
Disabled
Disabled visual styles should only be applied when a button is disabled.
Disabled buttons are unusable. Disable a button to keep users from interacting with the button until conditions are met.
Figma component (internal only)
Currently known as "Secondary" in our Figma library file.
A regular button may appear beside a primary button, or alone.
Use a regular button in place of a primary button.
Additional states are represented in our Figma library.
High contrast mode has different themes. The examples shown below are from Windows 11.
Desert theme
Night Sky theme
Figma component (internal only)
Additional states are represented in our Figma library.
High contrast mode has different themes. The examples shown below are from Windows 11.
Desert theme
Night Sky theme
Figma component (internal only)
Destructive type buttons use a different name (danger-button) in code implementations.
Most commonly found in confirmation modals.
Overuse destructive buttons.
Additional states are represented in our Figma library.
When designing for High contrast mode, we cannot use colors outside of the user's chosen palette, like the reds used in the destructive/danger button.
Use a primary or regular button instead.
Buttons are interactive elements, when a user engages a button there should be positive, non-blocking, accessible feedback that the interaction was successful.
This is possible through visual state changes on :hover, or :focus.
A button's outcome should be clear to the user before it is "pressed".
Button label text should be clear, descriptive, and use active verbs so people know what to expect when they interact with the button.
Casing: Write button text labels in sentence case. Capitalize the first word and lowercase the rest (unless the text contains a proper noun).
Width: Set a max width for the button, designing for at least 50+ string growth compared to English. Buttons themselves should not have a hard-coded fixed width — width is determined by length of text labels.
Stacking: Allow buttons to grow as much as they need to within the max width. When you have two buttons and they don’t fit in the same line, then wrap the button component itself (not the button text). The secondary button will move to the second line. Both buttons will be the same width.
To pressure test designs, use tools like Google Translate or Transvision to see how design reacts to Chinese, English, and German.
Not sure? Check with #l10n in Slack.
Need guidance? Check with #accessibility in Slack.
Date |
Version |
Notes |
---|---|---|
Apr 22, 2024 |
1.3.0 |
Added Storybook link |
Oct 5, 2023 |
1.2.0 |
Added restructured types, states and modes |
Mar 28, 2023 |
1.1.0 |
Added HCM theme info, and fixed some typos |
Feb 15, 2023 |
1.0.0 |
Initial draft of button guidance |
Overview of this component's status.
All States
Includes all applicable states (hover, focus, disabled, etc...)
All Themes
Works properly across all themes (theme name, theme name, etc...)
All Modes
Works properly across all modes (light, dark, high contrast)
All Desktop Environments
Works properly across all environments (Windows, MacOS, Linux)
All Mobile Environments
Works properly across all environments (iOS, Android)
Overall Accessibility
Has been tested and reviewed by A11y Team.
Color / Accessibility
All color has been tested against and passed all the latest WCAG 2.1 A & AA standards.
Text / Accessibility
All text has been tested against and passed all the latest WCAG 2.1 A & AA standards.
Contrast / Accessibility
All contrast has been tested against and passed all the latest WCAG 2.1 A & AA standards.
Interaction / Accessibility
All interactions have been tested against and passed all the latest WCAG 2.1 A & AA standards.
Content Design Review
Has been tested and reviewed by Content Design Team.
Writing Guidelines
Follows guidance for writing and language use.
Localization
Works properly across locales, and includes guidance for RTL languages.
Defined Behavior
Guidance for behavior when interacted with.
Defined Interactions
Guidance for interaction capabilities, ie. keyboard interactions.
Usage Guidelines
Includes guidance for usage, dos and don'ts, best practices.
Tokens
All attributes are available as tokens.
Figma Library
Has a reusable Figma component.
Storybook
Is documented in Storybook.
Code
Has a code counterpart.