Skip to content

Tabs

import { Tabs } from 'yarcl';

Overview panel. Use the arrow keys to move between tabs.

<Tabs defaultValue="overview">
<Tabs.List aria-label="Project">
<Tabs.Trigger value="overview">Overview</Tabs.Trigger>
<Tabs.Trigger value="activity">Activity</Tabs.Trigger>
<Tabs.Trigger value="billing" disabled>Billing</Tabs.Trigger>
</Tabs.List>
<Tabs.Panel value="overview"></Tabs.Panel>
<Tabs.Panel value="activity"></Tabs.Panel>
</Tabs>

Tab height comes from the shared size scale. Pass either value (controlled) or defaultValue (uncontrolled); the types require one of them.

Key Action
Tab moves to the selected tab, then into the panel
selects the previous or next tab, skipping disabled ones
Home End selects the first or last tab

Plus value (controlled) or defaultValue (uncontrolled).

PropTypeDefaultDescription
colorColorconfigconfig.defaults.colorColor of the selected tab's indicator, from the colors config.
onValueChange(value: string) => voidCalled with the newly selected tab's value.
sizeSizeconfigconfig.defaults.sizeTab height and font size, from the sizes config.
PropTypeDefaultDescription
value requiredstringIdentifies the tab; matches a Tabs.Panel's value.
PropTypeDefaultDescription
value requiredstringMatches the value of the Tabs.Trigger that shows this panel.