Skip to main content
Sidebar
@coinbase/cds-web@8.34.1
A composable and customizable vertical navigation component with support for multiple variants, collapsible states, and custom content areas.
Import
import { Sidebar } from '@coinbase/cds-web/navigation/Sidebar'
SourceView source codeStorybookView StorybookFigmaView Figma (internal only)
Related components
View as Markdown

Sidebar is a vertical navigation component for accessing different sections of an application. It supports multiple variants, collapsible states, and custom content areas.

Basics

A Sidebar is composed of the following parts:

  • Sidebar - The main container with logo and navigation items
  • SidebarItem - Individual navigation items with icon and title
  • SidebarMoreMenu - Overflow menu for additional navigation options
Loading...

Variants

Default

Use the Default variant on standard consumer-facing surfaces like Retail where maximum navigation and content space is desired. This variant shows full labels alongside icons.

Loading...

Condensed

Use in specialized workflows with complex data displays, such as Exchange and Advanced Trade, where navigation space is minimized to focus on core tasks. This variant displays icons with small labels below.

Loading...

Collapsed State

Controlled Collapse

Use the collapsed prop to control the sidebar's collapsed state. When collapsed, only icons are shown with tooltips for labels.

Loading...

Auto Collapse

Use the autoCollapse prop to automatically collapse the sidebar at or below the tablet breakpoint (768px). This is useful for responsive layouts where the sidebar should adapt to screen size.

Loading...

Custom Content

The logo prop accepts either a React element or a render function that receives the collapsed state. Use the render function when you need different logos for collapsed and expanded states.

Loading...

Render End

The renderEnd prop places content at the bottom of the sidebar. It receives the collapsed state as a parameter, allowing you to adapt the content based on the sidebar's state.

Loading...

Styling

Use the styles prop to customize specific parts of the sidebar.

Loading...

You can also use custom class names on the various subcomponents in Sidebar using the classNames prop.

const customLogoStyles = css`
padding-bottom: var(--spacing-6);
`;

function CustomClassNamesExample() {
const [activeIndex, setActiveIndex] = useState(0);
const items = [
{ title: 'Home', icon: 'home' },
{ title: 'Assets', icon: 'chartPie' },
{ title: 'Trade', icon: 'trading' },
{ title: 'Settings', icon: 'cog' },
];

return (
<Sidebar
logo={<LogoMark />}
classNames={{
logo: customLogoStyles,
}}
>
{items.map((item, index) => (
<SidebarItem
key={item.title}
active={index === activeIndex}
icon={item.icon}
onClick={() => setActiveIndex(index)}
title={item.title}
tooltipContent={item.title}
/>
))}
</Sidebar>
);
}

Composed Examples

Application Shell

A complete application layout with sidebar navigation, main content area, and responsive behavior.

Loading...

Condensed Trading Interface

A condensed sidebar optimized for professional trading interfaces with minimal visual footprint.

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.