Use a Button to allow a user to perform an action related to the content
currently displayed. For example, on a user profile page an "edit" button that
toggles an inline form for editing the profile content.
Attribute
Usage
Shape
Choosing a shape is highly dependent on context, however grouped buttons should always be the same shape
Fill
Fill is used to create hierarchy among grouped buttons
Size
Like shape, size is also dependent on context and grouped buttons should be the same size
Disabled
The disabled state is used to convey temporarily unavailable actions
Figma
Drag in a Button from the Buttons v2 library in the Assets pane in your
Figma file. We provide 5 semantic color variants to match what's available in
code.
React
Button composes
Chakra's Button component
and is available in four color schemes to indicate the type of associated
action.
A light color is also available for use on dark backgrounds.
When using the /next theme, the theming API for Button is slightly
different. The shape prop has no effect in the next theme and instead of
providing a fill, you'll want to specify the appropriate variant.
Theme Compatibility
It's possible to provide both fill and variant props to Button for
forward/backward compatibility between themes.
Enabling the Next Theme
See the Next Theme guide for instructions on how
to enable the /next theme in your project.
Variants
The Button supports four variants when using the next theme, primary,
secondary, tertiary and ghost.
Button supports color modes when using the next theme, but sometimes a
design calls for the colorScheme to override the mode. Pass light or dark
to set the color explicitly.
live
<NextProvider attach fontsHost="/typography/">
<Stack
direction="row"
spacing="300"
alignItems="center"
p="400"
bg="neutral.800"
m="-400"
>
<Button variant="primary" colorScheme="light">
Primary
</Button>
<Button variant="secondary" colorScheme="light">
Secondary
</Button>
<Button variant="tertiary" colorScheme="light">
Tertiary
</Button>
<Button variant="ghost" colorScheme="light">
Ghost
</Button>
</Stack>
</NextProvider>
As a link
If the action associated with an interaction is a navigation, consider using a
Link instead. If you definitely need it to
look like a button, but it acts as a link, you can use as="a"