Skip to main content

Tabs (native)

Switches between views without leaving the page. Stock Mantine Tabs, styled by the same stylesheet as the design system's Tabs — the two look identical apart from how the active line is drawn: this one gives every tab its own border, ours glides a single line between them.

Reach for this one deliberately

Tabs from the design system is the default. This page documents what you get from @mantine/core — supported, and the right choice when the motion is unwanted, but it is also what a call site ends up with by accident when autocomplete wins. If a project has the lint rule, import it under another name to say the choice was deliberate.

Base
Mantine + override
Mantine
Import
{ Tabs } from '@mantine/core'
Source
src/themes/theme.ts
src/themes/style-overrides/tab.module.css

Usage​

Oversikt-innhold
orientation
Deaktiver "Innstillinger"
React
<Tabs defaultValue="oversikt" orientation="horizontal">
<Tabs.List>
<Tabs.Tab value="oversikt">Oversikt</Tabs.Tab>
<Tabs.Tab value="detaljer">Detaljer</Tabs.Tab>
<Tabs.Tab value="innstillinger">Innstillinger</Tabs.Tab>
</Tabs.List>
<Tabs.Panel value="oversikt">Oversikt-innhold</Tabs.Panel>
<Tabs.Panel value="detaljer">Detaljer-innhold</Tabs.Panel>
<Tabs.Panel value="innstillinger">Innstillinger-innhold</Tabs.Panel>
</Tabs>

Props​

Only what this design system changes. Everything else is Mantine's — read the full props table there.

PropertyTypeAllowed valuesDefaultDescription
variantstring—defaultSelects the tab treatment. Only the default one is styled — every rule in tab.module.css is scoped under [data-variant='default'] — so Mantine's outline and pills still work but render unstyled.
orientationTabsProps['orientation']horizontal · verticalhorizontalLays the tab list out along a row or a column. It also fixes the tab height instead of leaving it to size — 48px in a row, 40px in a column.
sizeMantineSize——Has no visible effect: the tab font size is pinned to --mantine-font-size-sm whatever this is set to, and the height comes from orientation.
leftSection / rightSectionReactNode——Content beside the tab label. Add data-icon-position="top" on the Tabs.Tab yourself to stack the icon above the label instead — Mantine forwards unknown data-* props to the button.
Hover (inactive tab)———Not a prop. The border grows from 1px to 2px and switches to light-grey-5 (light mode) / dark-grey-1 (dark mode).
Disabled———Not a prop. Stays at full opacity with --mantine-color-disabled-color text, rather than Mantine's dimmed default.

Accessibility​

Mantine's Tabs follows the WAI-ARIA tabs pattern: Tabs.List gets role="tablist", each Tabs.Tab gets role="tab", and the active tab is the only one in the natural Tab order — arrow keys (and Home/End) move between the others, activating them as they go. Set activateTabWithKeyboard={false} if a tab should only activate on Enter/Space instead of on arrival.

A tab with only an icon and no visible text needs its own aria-label. If tabs are rendered as links via component or renderRoot, the role="tab" attribute still wins over the implicit link role, so screen readers announce "tab", not "link".

Active-tab text and the hover border both resolve through semantic tokens (--mantine-color-primary, --mantine-color-disabled-color) — see Accessibility for the contrast thresholds.