Tabs
Controlled or uncontrolled tabs with a sliding underline that travels between triggers.
Live — this one is real
Tokens are CSS custom properties scoped to --mizu-* namespaces. One stylesheet defines the surface; every component inherits it. Re-theming is an override, not a fork.
Usage
import { Tabs, TabsList, TabsTrigger, TabsPanel } from "mizu-ui";
export function Switcher() {
return (
<Tabs defaultValue="a">
<TabsList label="Settings">
<TabsTrigger value="a">General</TabsTrigger>
</TabsList>
<TabsPanel value="a">Panel content</TabsPanel>
</Tabs>
);
}
Source & setup
Add this component to your project with the shadcn CLI. The command copies its source into your configured UI directory, with base.css, Mizu’s tokens, and the stylesheets that hold its rules. Each rule lives in one stylesheet, so components you add together never repeat CSS. In a project without a components.json, run npx shadcn@latest init 0xuser64bit/mizu/preset first: plain init installs shadcn’s theme into your global CSS. Then load the fonts.
npx shadcn@latest add 0xuser64bit/mizu/tabsEvery component imports from its own path, its name in kebab case. To paste the example, replace its mizu-ui import with:
import { Tabs, TabsList, TabsTrigger, TabsPanel } from "@/components/ui/mizu/tabs";For npm imports, import mizu-ui/styles.css once. Fonts are optional via mizu-ui/fonts.css. Override --mizu-* tokens or use className for local styling. Requires React and Motion. A Client Component: its source starts with “use client”.
Inspect composite/Tabs.tsx
Source is included in the npm package under src/composite/Tabs.tsx.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value / defaultValue | string | — | Controlled value, or the initial value when uncontrolled. |
| onChange | (v: string) => void | — | Fires on selection (uncontrolled and controlled). |
Accessibility
Full tab pattern: tablist, tab with aria-selected, tabpanel. Inactive triggers are removed from the tab order.
Motion
The underline is a layout animation — it slides, it doesn't jump.