A button is an element on a page or view that tells a user what they can do and triggers an action.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/zendeskgarden/website/llms.txt
Use this file to discover all available pages before exploring further.
Anatomy
Buttons come in three types with distinct visual priority:- Primary — the most important action in a given view. Use one primary button per page or view.
- Default — secondary actions.
- Basic — repetitive or deemphasized actions in a given view.
Formatting
Size
Button size plays a part in content and user interaction. Clear labels and visual signifiers such as shape, color, and size help communicate the types of actions available and their priority in the process.- The default button size is medium
- Use small buttons on screens that have greater information density
Alignment
When a basic or default button is placed in conjunction with a primary button, the primary button should always be placed at the end.Do not place primary buttons at the start of action groupings. Users read left-to-right and expect the most important action last.
Variations
Buttons with media (icons)
Buttons can contain icon media positioned at the start or end, to provide additional context. Only use icons when necessary.Icon buttons
Where possible, avoid using icon-only buttons over buttons with labels. Labeled buttons maximize inclusivity for primary and secondary actions.States
Loading
Loading buttons display a Dots loader inside the button to show loading progress. The Dots loader appears after the user has initiated an action, signifying the site is loading the next action to occur. Buttons should not change size while loading.Disabled
A disabled button prevents user interaction. Disabled buttons do not appear in the tab order, cannot receive focus, and may not be read aloud by a screen reader.- Do
- Avoid
Keep buttons interactive. Add contextual, inline error notifications that set users up for success.
Flows
Buttons vs anchors
| Button | Anchor | |
|---|---|---|
| Purpose | Trigger an action on a page or view | Navigate from one location to another |
| Examples | Save, Submit, Delete, Open modal | Go to settings, View details, External link |
| Component | <Button> | <Anchor> |
Content guidelines
The button call-to-action (CTA) should guide the experience, not just finish a page. Typically, the CTA repeats the page heading when possible (e.g., “Add agent”). This phrase repetition confirms the action that will take place.| Guideline | Do | Avoid |
|---|---|---|
| Use verbs | ”Save changes”, “Add agent" | "OK”, “Yes”, “Confirm” |
| Sentence case | ”Save changes" | "Save Changes”, “SAVE CHANGES” |
| Length | 1–4 words, 20 character max | Long phrases with articles or pronouns |
| Single action | ”Delete ticket" | "Delete ticket and notify user” |
| Context | ”Add agent”, “Create ticket" | "Yes”, “No”, “Maybe” |
Localization and internationalization
RTL (right-to-left)
Actions need to accommodate different languages (making them wider or shorter) and both left-to-right and right-to-left direction. Keep in mind that the width of actions will change and act accordingly. For RTL languages, the layout of the button is mirrored. Split buttons automatically switch the position of the dropdown and label. Media elements such as icons are placed on the right side of the text in RTL.Accessibility
Keyboard support
Users must be able to activate a button by pressingEnter or Space while the button has focus.
ARIA attributes
Toggle buttons
Toggle buttons use thearia-pressed attribute to indicate the current pressed state.
- Set
aria-pressed="false"when the button has not been pressed - Set
aria-pressed="true"once it has been pressed
Icon buttons
Icon buttons use thearia-label attribute to provide an accessible text label for the icon. Ensure the label is appropriately localized on implementation.
Dropdown buttons
When a button opens a dropdown menu:- Set
aria-expanded="false"when the menu is closed;aria-expanded="true"when open - Set
aria-controlsto theidof the expandable menu - Set
aria-haspopup="true"