Buttons

Buttons allow users to perform an action.

Best Practices

  • Use buttons to trigger actions or to submit forms.
  • Only one primary button should appear on each page.
  • In general, when placing buttons on the page, a primary button should appear before secondary or disabled buttons.

Accessibility

  • Label buttons with what they do. Add a clear message of what happens after the click.
  • Ensure sure the label text makes sense out of context. Be explicit.

Color Application

Buttons will use the primary theme color by default. Set your color property to apply the secondary or neutral colors.

Contained Buttons

Contained buttons are used for primary actions and are distinguished by their use of elevation and fill.

Outlined Buttons

Outlined buttons can act as a lower-emphasis alternative to contained buttons or a higher-emphasis alternative to text buttons.

Text Buttons

Text buttons are typically used for less-pronounced actions, including those located:

  • In dialogs
  • In cards

In cards, text buttons help maintain an emphasis on card content.

Note: If intended as an anchor, use the Link component.

Disabled Buttons

Use disabled buttons with caution. According to WCAG guidelines, disabled buttons are not required to meet the contrast requirements. Regardless, they are difficult to read and many users may miss them. Instead, use enabled buttons with appropriate validation notifications.

When using on a form submission awaiting a data or validation response, update the button’s label with appropriate feedback, such as “Loading.” Or better yet, swap the button with a loading indicator with accompanying text for a screen-reader to announce. Demo coming soon.

Floating Action Buttons

A floating action button (FAB) performs the primary, or most common, action on a screen. In fact, the FAB should ideally represent the primary function of your entire app. It appears in front of all screen content, typically as a circular shape with an icon in its center. FABs come in two types: regular and extended.

  • Only use a FAB if it is the most suitable way to present the primary action.
  • Only one floating action button is recommended per screen to represent the most common action.

The floating action button animates onto the screen as an expanding piece of material, by default.

A floating action button that spans multiple lateral screens (such as tabbed screens) should briefly disappear, then reappear if its action changes.

The Zoom transition can be used to achieve this. Note that since both the exiting and entering animations are triggered at the same time, we use enterDelay to allow the outgoing Floating Action Button's animation to finish before the new one enters.

Sizes

For larger or smaller buttons, use the size property.

Buttons with Icons

Icons should be placed before the text for consistency.

Icon Buttons

Icon buttons are commonly found in app bars and toolbars.

Icons are also appropriate for toggle buttons that allow a single choice to be selected or deselected, such as adding or removing a favorite to an item.

Button Group

Also referred to as "segmented buttons", a ButtonGroup contains related actions.

An active button may be preselected, as demo'd, or the value may be left to change upon user interaction.

Fullwidth

Small

Third-Party Routing

One common use case is to use the button to trigger a navigation to a new page. The ButtonBase component provides a property to handle this use case: component. Given that a lot of the interactive components rely on ButtonBase, you should be able to take advantage of it everywhere:

Properties