Nav
The thread header — scroll progress with a diamond node, chapter tracking, and a full-screen mobile menu.
Live — this one is real
This frame has its own scroll and modal context. Narrow the preview to try the mobile menu.
Usage
import { Nav } from "mizu-ui";
export function Shell() {
return (
<Nav
brand={<strong>MIZU.</strong>}
links={[{ href: "/", label: "Home" }]}
currentPath="/"
/>
);
}
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/navEvery component imports from its own path, its name in kebab case. To paste the example, replace its mizu-ui import with:
import { Nav } from "@/components/ui/mizu/nav";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/Nav.tsx
Source is included in the npm package under src/composite/Nav.tsx.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| brand | ReactNode | — | Logo or wordmark. |
| links | { href, label }[] | — | Primary navigation links. |
| actions | ReactNode | — | Controls kept in the bar at every width, beside the links or the Menu button: search, a theme switch, an account. |
| currentPath | string | — | Current path for active state. Defaults to window.location.pathname. |
| trackChapters | boolean | true | Observe [data-chapter] sections and show the current chapter. |
Accessibility
Semantic header/nav; mobile menu uses native modal focus containment, locks scroll, and closes on Escape.
Motion
Progress line is a spring-smoothed scroll link; the chapter label crossfades; the mobile menu is a full-screen fade.