Skip to main content
Checkbox
@coinbase/cds-web@8.34.1
Checkbox is a type of control component that allows user to select one or more options from a set. They can also be used alone to switch between on and off.
Import
import { Checkbox } from '@coinbase/cds-web/controls/Checkbox'
SourceView source codeStorybookView StorybookFigmaView Figma (internal only)
Peer dependencies
  • framer-motion: ^10.18.0
View as Markdown

Basic Usage

Checkbox UI and state management are separated so that you can swap in any form or state code you like.

Loading...

Custom Layout

If you don't want to use the default label or layout style, you can just not provide children to the Checkbox component. However, you should think about wrapping the custom label and Checkbox in a <label> if it makes sense to increase the tap target of the component and allow users to toggle by pressing on the label as well.

Loading...

Different States

Checkboxes support various states including disabled and indeterminate.

Loading...

Custom Colors

Like other control components (i.e. Radio, Switch), you can customize the color of the Checkbox by setting the controlColor prop.

Loading...

For more advanced customization, you can also control the border shape and thickness using borderRadius and borderWidth, along with background and borderColor:

Loading...

Multiple Checkboxes

For multiple checkbox scenarios, use ControlGroup with role="group" for better accessibility and state management:

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.