Tabs
Tabs, and a floating tab bar with a lens you can drag between items.
Installation#
$ pnpm dlx shadcn@latest add @liquikit/tabsNeeds the @liquikit registry in your components.json. Set it up once.
Usage#
import { Tabs } from "@/components/liquikit/tabs"<Tabs.Root defaultValue="overview">
<Tabs.List tabs={[{ value: "overview", label: "Overview" }, { value: "activity", label: "Activity" }]} />
<Tabs.Panel value="overview">…</Tabs.Panel>
<Tabs.Panel value="activity">…</Tabs.Panel>
</Tabs.Root>Examples#
Tab bar#
Tabs.Bar is the floating bar from the bottom of a phone screen, with an icon over each label.
API Reference#
Tabs.Root
| Prop | Type | Default |
|---|---|---|
value | stringThe current value, when you control it. | — |
defaultValue | stringThe value it starts with, when it manages its own state. | — |
onValueChange | (value: string, eventDetails?: BaseTabs.Root.ChangeEventDetails) => voidCalled with the new value when the user changes it. | — |
Also takes every prop of Base UI's tabs, plus className and style.
Tabs.List
| Prop | Type | Default |
|---|---|---|
theme | "light" | "dark"Light or dark glass. Falls back to the nearest | — |
lens | Partial<LensProfile>Overrides for the lens profile, such as | — |
liquid | numberHow far the glass squashes and stretches as it moves. | — |
tabs* | ReadonlyArray<string | Segment>The tabs, as strings or | — |
height | numberHeight of the tab row, in pixels. | — |
Also takes every prop of Base UI's tabs, plus className and style.
Tabs.Bar
| Prop | Type | Default |
|---|---|---|
theme | "light" | "dark"Light or dark glass. Falls back to the nearest | — |
lens | Partial<LensProfile>Overrides for the lens profile, such as | — |
liquid | numberHow far the glass squashes and stretches as it moves. | — |
height | numberHeight of the bar, in pixels. | 50 |
tabs* | ReadonlyArray<TabBarItem>The tabs, each with a | — |
refraction | "interactive" | "always"When the glass bends the page. | "interactive" |
Tabs.Panel
| Prop | Type | Default |
|---|---|---|
value* | stringThe tab this panel belongs to. | — |
Also takes every prop of Base UI's tabs, plus className and style.