Skip to main contentCarbon Design System

Content switcher

Content switchers allow users to toggle between two or more content sections within the same space on screen.

Overview

Content switchers allow users to toggle between alternate views of similar or related content. Only one content section is shown at a time.

When to use

Content switchers are frequently used to let users toggle between different formatting, like with a grid view and a table view. They are also often used to narrow content groups. For example, use a content switcher if you have a single category, such as “E-mail” and you want to divide it into views such as “All”, “Read”, and “Unread”.

Example of a content switcher

When not to use

Tabs

Use tabs when the content on the page is divided into related sections, but without any overlap. Tabs follow the metaphor for sections in a filing cabinet and two tabs wouldn’t contain the same sheet of paper. So the role of tabs in information hierarchy is to separate content.

Toggle

The content switcher is used for large groups of content, as opposed to the toggle which is meant for a “yes/no” or “on/off” binary decision.

Live demo

<ContentSwitcher onChange={console.log}>
<Switch name={'first'} text='First section' />
<Switch name={'second'} text='Second section' />
<Switch name={'third'} text='Third section' />
</ContentSwitcher>
Switch
Modifiers
ContentSwitcher
size

Formatting

Anatomy

Anatomy of a content switcher group.
  1. Selected content tab: Only one content tab can be selected at a time and there should always be one selected.
  2. Content tab: Selectable container for each content view.
  3. Text label: Describes the content view.

Sizing

Height

There are three height sizes for the content switcher: small (32px), medium (40px), and large (48px). Choose a size that best fits the density of your layout or the prominence of the switcher.

Height options for content switcher

Width

The overall content switcher width varies based on the content and layout. Each individual content tab should be the same width. The content tab with the longest text label should have 16px spacing to the right of the label. The width of all other tabs should match the widest tab.

Do base content tab width on the longest text label.

Do base content tab width on the longest text label.