Content switcher
Overview
The content switcher component allows users to toggle between two or more content sections within the same space. It provides a segmented control interface that functions as either a radio group (single selection) or checkbox group (multiple selections). The component is fully accessible with keyboard navigation, form integration, and comprehensive validation support.
When to Use
✅ Use content switchers when:
Switching between different views of the same content (e.g., list/grid views)
Toggling between related content sections (e.g., tabs, panels)
Filtering content with mutually exclusive options
Creating navigation between related pages or sections
Building multi-step forms with section selection
❌ Don't use content switchers for:
Binary on/off toggles (use switch components)
Single option selection from many choices (use radio buttons)
Multiple selections from many options (use checkboxes)
Primary navigation between unrelated pages
Actions that trigger immediate changes (use buttons)
Design system docs
Examples
Basic Usage
The default content switcher acts as a radio group where only one option can be selected at a time:
< dap-ds-content-switcher label = " View options " >
< dap-ds-content-switcher-item value = " list " > List View </ dap-ds-content-switcher-item >
< dap-ds-content-switcher-item value = " grid " > Grid View </ dap-ds-content-switcher-item >
< dap-ds-content-switcher-item value = " table " > Table View </ dap-ds-content-switcher-item >
</ dap-ds-content-switcher >
Pre-selected Value
Set a default selection using the value
attribute:
< dap-ds-content-switcher value = " grid " label = " Display mode " >
< dap-ds-content-switcher-item value = " list " > List </ dap-ds-content-switcher-item >
< dap-ds-content-switcher-item value = " grid " > Grid </ dap-ds-content-switcher-item >
< dap-ds-content-switcher-item value = " table " > Table </ dap-ds-content-switcher-item >
</ dap-ds-content-switcher >
Multiple Selection
Enable multiple selections by setting the multiSelect
attribute. The value
should be a comma-separated list:
< dap-ds-content-switcher multiSelect value = " email,sms " label = " Notification preferences " >
< dap-ds-content-switcher-item value = " email " > Email </ dap-ds-content-switcher-item >
< dap-ds-content-switcher-item value = " sms " > SMS </ dap-ds-content-switcher-item >
< dap-ds-content-switcher-item value = " push " > Push </ dap-ds-content-switcher-item >
< dap-ds-content-switcher-item value = " inapp " > In-App </ dap-ds-content-switcher-item >
</ dap-ds-content-switcher >
Importing
Importing React
Attributes
Property Type Default Description multiSelect
boolean
false
Whether the content switcher allows multiple selections. value
string
The value of the content switcher. A comma-separated list if multiSelect
is true
.
Slots
Name Description (default)
The content switcher items.
Events
Event Name Description Type dds-change
Fired when the content switcher is changed. {value: string, selected: boolean }
CSS Parts
Part Name Description base
The main content switcher container.
CSS Custom Properties
Property Name Description --dds-content-switcher-min-width
The minimum width of the content switcher (default: var(--dds-spacing-4000, 160px)) --dds-content-switcher-padding
The padding of the content switcher (default: var(--dds-spacing-100, 4px)) --dds-content-switcher-border-width
The border width of the content switcher (default: var(--dds-border-width-base)) --dds-content-switcher-border-color
The border color of the content switcher (default: var(--dds-border-neutral-transparent)) --dds-content-switcher-border-radius
The border radius of the content switcher (default: var(--dds-radius-rounded, 1000px)) --dds-content-switcher-background
The background color of the content switcher (default: var(--dds-transparent-black-subtle, rgb(0 0 0 / 5%))) --dds-content-switcher-gap
The gap between content switcher items (default: var(--dds-spacing-100, 4px))
Components
Content switcher item
<dap-ds-content-switcher-item/>
Attributes
Property Type Default Description value
string
The value of the segmented control item. checked
boolean
false
The checked state of the segmented control item. disabled
boolean
false
The disabled state of the segmented control item. name
string
The name of the segmented control item.
Slots
Name Description iconcontent
The icon content of the segmented control item.
Events
No custom events available.
CSS Parts
Part Name Description input
The input of the segmented control item.
CSS Custom Properties
Property Name Description --dds-content-switcher-item-height
The height of the content switcher item (default: var(--dds-spacing-800, 32px)) --dds-content-switcher-item-padding
The padding of the content switcher item (default: var(--dds-spacing-200, 8px) var(--dds-spacing-400, 16px)) --dds-content-switcher-item-font-size
The font size of the content switcher item (default: var(--dds-size-sm, 14px)) --dds-content-switcher-item-font-weight
The font weight of the content switcher item (default: var(--dds-weight-bold, 700)) --dds-content-switcher-item-border-radius
The border radius of the content switcher item (default: var(--dds-radius-large, 16px)) --dds-content-switcher-item-background
The background color of the content switcher item (default: transparent) --dds-content-switcher-item-color
The text color of the content switcher item (default: var(--dds-text-neutral-base)) --dds-content-switcher-item-border-color
The border color of the content switcher item (default: transparent) --dds-content-switcher-item-checked-background
The background color of the checked content switcher item (default: var(--dds-button-primary-background-enabled)) --dds-content-switcher-item-checked-color
The text color of the checked content switcher item (default: var(--dds-text-neutral-on-inverted)) --dds-content-switcher-item-checked-border-color
The border color of the checked content switcher item (default: var(--dds-border-neutral-transparent-interactive))