View Switch
ViewSwitch is the List or Cards control in a record list’s toolbar. It reports the pick and nothing more: what switching does to the page is the screen’s. Cards are always by status, and switching views opens every group.
Live demo
Showing list view
Behavior
- Icon-only, with the accessible names “List view” and “Cards view” and a tooltip naming each.
- Switching views opens every group in the list that follows. The screen does this by remounting its
GroupedTablewith a newkey.
Usage
import { ViewSwitch, type RecordView } from "@beacon/design-system";
const [view, setView] = useState<RecordView>("list");<ViewSwitch value={view} onChange={setView} />;Props
| Prop | Type | Description |
|---|---|---|
value | "list" | "cards" | The current view. |
onChange | (next: RecordView) => void | Called with the view the person picked. |
In the workflow toolbar
On a workflow list the switch sits inside Workflow Toolbar, which owns the rest of the row. Use ViewSwitch on its own only outside a workflow list.