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.
<Gridcontainerspacing={2}>
<Griditemxs={12}>
<Buttondisabled>Contained Disabled</Button>
</Grid>
<Griditemxs={12}>
<Buttonvariant="outlined"disabled>
Outlined Disabled
</Button>
</Grid>
<Griditemxs={12}>
<Buttonvariant="text"disabled>
Text Disabled
</Button>
</Grid>
</Grid>
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.
<Gridcontainerspacing={2}>
<Griditemxs={12}>
<Fabcolor="primary"aria-label="Add">
<Add/>
</Fab>
</Grid>
<Griditemxs={12}>
<Fabcolor="secondary"aria-label="Edit">
<Edit/>
</Fab>
</Grid>
<Griditemxs={12}>
<Fabvariant="extended">
<Navigation/>
Extended
</Fab>
</Grid>
<Griditemxs={12}>
<Fabdisabledaria-label="Delete">
<Delete/>
</Fab>
</Grid>
</Grid>
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.
Icons should be placed before the text for consistency.
<Gridcontainerspacing={2}>
<Griditemxs={12}>
<Buttoncolor="secondary">
<Delete/>
Delete
</Button>
</Grid>
<Griditemxs={12}>
<Button>
<Navigation/>
Directions
</Button>
</Grid>
</Grid>
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.
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.
<ButtonGroup>
<Button>Button A</Button>
<Buttonactive={true}>Button B</Button>
<Button>Button C</Button>
</ButtonGroup>
Fullwidth
<ButtonGroupfullWidth>
<Button>Button A</Button>
<Buttonactive={true}>Button B</Button>
<Button>Button C</Button>
</ButtonGroup>
Small
<ButtonGroupsize="small">
<Button>Button A</Button>
<Buttonactive={true}>Button B</Button>
<Button>Button C</Button>
</ButtonGroup>
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: