Skip to content

Internal ID software / Overlays

Tabs

Views of the same thing, one at a time, with the whole keyboard model.

Not drawn in Figma: built only from the tokens, for internal ID software. In code: components/software/overlay.tsx. From the old system: Tabs in @id-identity-as/ui/overlay.

Example

Piletasterne flytter mellem fanerne. Home og End hopper til enderne.

Piletasterne flytter mellem fanerne. Home og End hopper til enderne.

import { Tabs } from '@/components/software/overlay';

<Tabs
  label="Vis ordren som"
  items={[
    { id: 'lines', label: 'Linjer', content: <Table ... /> },
    { id: 'history', label: 'Historik', content: <Text>...</Text> },
  ]}
/>

Props

PropTypeDefaultWhat it does
label (required)stringThe name of the tab list, read aloud.
items (required)TabItem[]{ id, label, content }.
defaultSelectedKeystringThe tab shown from the start, uncontrolled. Defaults to the first.
selectedKeystringThe tab shown. With onSelectionChange the tabs are controlled.
onSelectionChange(key: string) => voidCalled with the id of the new tab.

Do

  • Use tabs for views of one thing: the lines and the history of an order.
  • Keep the labels to a word or two.
  • Control it and keep the choice in the address when a tab should be shareable.

Do not

  • Do not use tabs for navigation between pages. That is Navigation.
  • Do not let the tab list wrap. It scrolls sideways.

Accessibility

  • The ARIA tabs pattern: arrow keys move along the list, Home and End jump to the ends.
  • Only the chosen tab is in the tab order, and each panel is tied to its tab and can take focus.

Tokens it uses

  • color.border.default
  • color.text.default
  • color.software.muted
  • type.body.md
  • space.inline.3
  • space.inline.4