Button
A common action that can be easily performed with one click or tap.
Page sections
Types
Default
Primary
Tertiary
Icon-Only
Usage
Buttons represent actions, such as submitting data, launching elements, toggling visibility, etc. If navigating to a different site or page, a link should be used.
Overview
- Default Button: Used for general actions on a page or in a section
- Primary Button: Used to call attention to the main action of the page or large section. Though it should generally be used only once per page, Primary Buttons can be used multiple times if representing parallel primary actions, such as “Add to Cart.”
- Tertiary Button: Used for subtle actions on a page or in a section that are not a priority
- Icon-only Button: Used for actions that can be commonly identified without words, such as “Print”
Alignment
To maximize usability and accessibility, Buttons should generally align to the content with which they’re associated.
Primary Button order
Primary actions should generally be presented first within a group of buttons.
Directional buttons, however, don’t follow the “Primary first” rule and should appear in a more natural order.
Button groups
Multiple priorities
Similar priorities
Full-width
Primary and Default Buttons should generally be full-width on mobile. On desktop, they also be full-width if they’re within small content regions.
Behavior
Loading
Sometimes a Button represents an action whose completion doesn’t immediately occur. In such cases, Button has a loading state that communicates the action is still underway.
Visual style
Content strategy
- Use Title Case for labels
- Try to keep labels short, around 1-4 words
- Lead with a verb
- Add specificity with purpose (e.g. “Search Physicians” serves a direct purpose by orienting the user)
- Use simple global commands when possible: Save, Back, Next, Apply, etc.
Accessibility
Characteristics
- All enabled and hover states pass WCAG AA contrast
- Disabled states do not need to pass WCAG AA contrast guidelines, however, our disabled buttons have about 20% more contrast than the average disabled button
- All Button types have a default height of 48px to account for touch target sizes on touch screens
Keyboard/focus expectations
- Enabled Button receives screen reader and tab focuses
- Disabled Button receives screen reader focus and tab focus
- Activates using Enter or Spacebar
- Watch State: Focus shifts to ARIA live region after Button is activated and remains there until action is performed or error message is displayed
Screen reader expectations
If using Button as a Button, Name, Role, and State (if applicable) will be announced when Button receives focus. For example, if the Button label is “Assign Physician,” the button will read out: Assign Physician, button. If the Button has a State, such as disabled or in a watch state, the state will be read out at the end, for example: Assign Physician, button, disabled.
A description (if applicable) can be added and announced when button receives focus. For example: Assign Physician, button, assigning a physician will replace any previously assigned physician.
Watch states:
- Use
aria-live="polite"
on the<button>
- Focus stays on the Button until script finishes processing and the user is taken to the next appropriate element