Skip to main content
Tabs
@coinbase/cds-web@9.28.0
Tabs is a flexible, accessible tab list for switching between related views. Use `DefaultTab` and `DefaultTabsActiveIndicator` for a standard underline tab row without wiring custom components, or supply your own `TabComponent` and `TabsActiveIndicatorComponent` for full control. For pill-style selection, see SegmentedTabs.
import { Tabs, DefaultTabsActiveIndicator } from '@coinbase/cds-web/tabs'
Peer dependencies
  • framer-motion: ^10.18.0
Related components

Tabs manages which tab is active and positions the animated indicator. For pill / segmented controls, use SegmentedTabs instead.

Basics​

Out of the box, Tabs uses DefaultTab for each row (headline text, optional DotCount via count / max on each tab) and DefaultTabsActiveIndicator for the animated underline. Set color / activeColor on Tabs for inactive / active label tokens, and activeBackground for the underline (forwarded to the indicator as its background token).

Loading...

No initial selection​

Loading...

Dot counts​

Optional count and max on each tab are forwarded to the badge next to the label (see DotCount).

Loading...

Disabled​

Disable the whole row with disabled, or set disabled: true on individual tab items.

Loading...

Accessibility​

Provide a descriptive accessibilityLabel on Tabs for the tab list. DefaultTab sets aria-controls / aria-selected for each tab; pair tabs with role="tabpanel" regions in your page content when you switch panels.

Styling​

Colors​

You can set color and activeColor for label tokens, and activeBackground for the underline.

Loading...

Custom TabComponent​

Use useTabsContext inside your own tab button.

Loading...

Custom label content​

Pass extra fields on each tab and read them in your TabComponent (for example icons).

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.