Skip to main content
Button
@coinbase/cds-web@9.28.0
A pressable button element.
import { Button } from '@coinbase/cds-web/buttons/Button'
Related components

Buttons allow users to take actions and make choices with a single tap. They communicate what action will occur when the user interacts with them.

Basics​

The only required prop is children, which is the button's label. Buttons default to the primary variant.

Loading...

Variants​

Use variants to communicate the importance and intent of an action.

  • Primary — High emphasis for main actions like "Save" or "Confirm". Limit to one per screen.
  • Secondary — Medium emphasis for multiple actions of equal weight.
  • Tertiary — Low emphasis with a muted background.
  • Inverse — High contrast with inverted background.
  • Negative — Destructive actions that can't be undone. Use sparingly.
Loading...

Transparent​

Use transparent buttons for supplementary actions with lower prominence. The container is only visible on interaction. Works with any variant.

Loading...

States​

Loading​

Use the loading prop to indicate an action is in progress. The button becomes non-interactive and displays a loading indicator (indeterminate ProgressCircle) while preserving its width.

Loading by variant​

Loading works with all variants and transparent. The label is hidden and the progress circle is shown in the button’s accent color.

Loading...

Interactive loading​

Toggle loading state to see the transition. Use for async actions like save or submit.

Loading...

Disabled​

Use the disabled prop to prevent interaction and indicate the action is unavailable.

Loading...

Sizes​

size accepts xs, s, m, and l. Defaults to l.

Loading...

Block​

Use block to make the button expand to fill its container width.

Loading...

Typography​

Button forwards text-related font props to the internal Text label, so you can customize typography without rendering a custom child.

Loading...

Icons​

End Icon​

Add an icon after the label to provide additional context or indicate direction.

Loading...

Start Icon​

Add an icon before the label to reinforce the action.

Loading...

Full Width with Icons​

When using block with icons, the content automatically spreads across the button width.

Loading...

Accessibility​

Buttons automatically use their children as the accessible label. For buttons with only icons or ambiguous labels, provide an accessibilityLabel.

<Button onClick={handleClose} accessibilityLabel="Close dialog">
×
</Button>

Composed Examples​

Confirmation Dialog​

A common pattern using primary and secondary buttons together.

Loading...

Destructive Confirmation​

Use negative buttons with a secondary cancel option for destructive actions.

Loading...

Form Actions​

A full-width primary action with a compact secondary option.

Loading...

Is this page useful?

Coinbase Design is an open-source, adaptable system of guidelines, components, and tools that aid the best practices of user interface design for crypto products.