<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5HGSQD2L" height="0" width="0" style="display:none;visibility:hidden" title="GTM"></iframe>

Button

Used to trigger an in-page action such as submitting a form or showing/hiding an interface component.
styleKeys: buttonstyleKeys: spinner

Use Button...

  • To trigger an in-page action such as submitting a form or showing/hiding an interface component.

Don't use Button...

  • To link to another page. Use Link instead, or render the Button as a link.

The preview has been updated.

Skin

Use skin to choose the styling of Button based on the use case. Refer to guidelines on which skin to use.

The preview has been updated.

Size

Use size="mini" to reduce the size of a Button.

The preview has been updated.

Width

Use width="full-width" to grow a Button to fill its container.

The preview has been updated.

Disabled

Use disabled when a Button’s action is unavailable. Refer to guidelines.

The preview has been updated.

Icons

An Icon can be placed inside Buttons. Use buttonShape="round" for icon only buttons. Use objectFit to accommodate different sized custom icons.

The preview has been updated.

Loading

Use loading to indicate that an action is in progress. The Button will render a [Spinner] to visually indicate the loading state.

For assistive technologies, the visual updates must be accompanied by an ARIA live region on your page (not as a descendant of Button) to announce changes even when the Button is not in focus.

Do not render the live region conditionally as it can lead to announcement issues - instead render the text inside the live region conditionally. An example can be seen below:

The preview has been updated.

The preview has been updated.

Design Path

Use specialVariant="design-path" for Buttons in the design path flow that require a second line for a description.

The preview has been updated.

Clear Selection

Use skin="clear-selection" for Buttons that show user selections.

The preview has been updated.

Use render for Buttons with the behavior of a Link. Refer to render prop guidelines.

The preview has been updated.

Use render for Links with the behavior of a Button. Refer to render prop guidelines.

The preview has been updated.

Unstyled

Use skin="unstyled" for Buttons with no styling.

The preview has been updated.

Buttons in Banner

When used inside Banner, Buttons have a different styling to make them more neutral. This allows them to sit on a wide range of colors often used as Banner backgrounds without clashing.

The preview has been updated.

Skin

  • Use secondary for all Buttons by default. Multiple secondary actions can be displayed on a page.
  • Use primary for the main action of the page.
    • Limit to a single primary Button per page if possible to guide users through the purchasing flow and help them easily get to the cart.
    • Multiple primary buttons can be used for upsell (adding extra items to checkout).
  • Use tertiary when a more subtle Button is required.
  • Use destructive-primary if an action will destroy data, usually within a confirmation Modal Dialog.
  • Use destructive-secondary to indicate an action will destroy data. This action would usually trigger a Modal Dialog confirming the destruction of data.
  • Use destructive-tertiary when a more subtle Button is required. This action would usually trigger a Modal Dialog confirming the destruction of data.

Content

  • Use clear, concise labels to describe the action being performed by the Button.
  • Use sentence case.
  • Do not use punctuation.
  • Buttons will grow wide enough to accommodate their content. If there is not enough room for the Button to grow, the text will wrap to the next line.
  • Ensure Button content is short and succinct to avoid wrapping.

Placement

  • Place Buttons in flow near relevant content, with negative space to call the maximum amount of attention to the action.
  • Align Buttons accordingly with the content grouping for visual consistency. For example, left-aligned typography includes a left-aligned Button.

Disabled

  • Disabling Buttons can confuse users since they afford little feedback. Users may not understand why the Button can’t be clicked, and be blocked progressing through the flow. It is often better to allow a Button to be clicked, then communicate to the user what is blocking them from progressing.
  • Use Buttons to perform an action on the current page. Use links to take users to a new page.
  • Buttons can be styled to appear as a link. Links can be styled to appear as a Button.

Accessibility

  • Ensure Buttons have appropriate contrast when placed on busy backgrounds.

Props

Button
This component is implemented using the <button /> as the root element. You can utilize the native attributes supported by <button /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.
proptyperequireddescriptiondefault
width"standard" | "full-width" | "wide" | nullfalse
The width variation
standard
loadingboolean | nullfalse
Activates the loading state. Should be used with a separate live region to provide updates to screen readers.
null
size"standard" | "mini" | nullfalse
⚠️ Deprecated - This is deprecated without a replacement.
The size variation
standard
skin"link" | "primary" | "secondary" | "unstyled" | "tertiary" | "clear-selection" | "destructive-primary" | "destructive-secondary" | "destructive-tertiary" | nullfalse
The visual style of the Button
secondary
specialVariant"standard" | "design-path" | nullfalse
Variations for special cases
standard
iconPosition"left" | "right" | nullfalse
The position of the icon in the Button
null
buttonShape"standard" | "round" | nullfalse
The shape of the Button
standard
ButtonDescription
This component is implemented using the <span /> as the root element. You can utilize the native attributes supported by <span /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.
ClearSelectionButtons
This component is implemented using the <div /> as the root element. You can utilize the native attributes supported by <div /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.
ClearAllButton
This component is implemented using the <button /> as the root element. You can utilize the native attributes supported by <button /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.

Related