Draft. Ported from the shadcn-vue Tabs used in control-center, restyled with Beehexa tokens. Not yet approved. It is in the registry so teams can try it; the API may still change before approval.
Tabs split one page into views of the same thing, such as a connection’s overview, mappings and history. One view shows at a time, and the tabs stay in place above it.
When to use
- To split a page into views of the same object, when each view is big enough to need the space: a table, a form, a log.
- In the page header, under the title, as the last row (Layout › App frame).
- For settings with several sections, as vertical tabs.
When not to use
- To switch how nearby content is shown, such as List or Grid, or Day, Week, Month. Use a segmented control. It changes a setting of one view; tabs change the view (D17).
- To move to another page. Use the sidebar or a link. A tab never changes the URL to a different page.
- For steps that must be done in order. Use a stepper.
- For one or two short sections. Show them on the page, one under the other.
- In a form that is submitted. People miss fields hidden in other tabs.
Tabs or segmented control
| Tabs | Segmented control | |
|---|---|---|
| Changes | The view: different content below | A setting of the same content |
| Look | Text on the page, a bar under the selected one | A track with a raised segment |
| Where | Page header, top of a card or panel | Next to the content it changes |
| Role | tablist, tab, tabpanel |
radiogroup, radio |
Content
- One or two words, sentence case: “Overview”, “Sync history”. No full stop.
- Name the view, not an action: “Mappings”, not “Edit mappings”.
- Add a count when it helps people choose: “Failed 3”. Keep it in the tab text so it is part of the name.
- Don’t cut a tab label. If the tabs don’t fit, shorten the labels or use fewer tabs.
States
| State | Look |
|---|---|
| Rest | color.text.subtle, no fill |
| Hover | color.background.neutral.subtle.hover, text color.text |
| Selected | color.background.selected, text color.text, and a 2 px bar in color.border.selected (border.width.selected). The text keeps its weight (D24) |
| Focus | 2 px ring in color.border.focus, 2 px away |
| Disabled | color.text.disabled. Prefer hiding a view people can’t open, or say why on the page |
Tokens
| Part | Token |
|---|---|
| Tab height | size.control.default (32 px) |
| Side padding | space.control.x |
| Text | font.label.default |
| Corners | radius.control, top corners only |
| Line under the list | border.width.default, color.border |
| Space to the panel | space.200 |
On touch screens each tab is 44 px high (size.target.touch), as rows are (Size and density).
Related
- Segmented control: change how one view is shown.
- Interaction states: the selected fill and bar.
- Border:
border.width.selected.