Tilt
A restrained depth response to the pointer, returning cleanly to rest.
Live — this one is real
POINTER STUDY
A little depth.
Move across the surface. The reading order and hit targets stay familiar.
Usage
import { Tilt, Frame } from "mizu-ui";
export function Example() {
return (
<Tilt max={5}>
<Frame>
<div style={{ padding: 32 }}>
<p className="mizu-field-hint">POINTER STUDY</p>
<h3
style={{ fontSize: 36, letterSpacing: "-.04em", margin: "20px 0" }}
>
A little depth.
</h3>
<p className="mizu-field-hint">
Move across the surface. The reading order and hit targets stay
familiar.
</p>
</div>
</Frame>
</Tilt>
);
}
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/tilt 0xuser64bit/mizu/frameThe example also uses Frame, so the command adds it too.
Every component imports from its own path, its name in kebab case. To paste the example, replace its mizu-ui import with:
import { Tilt } from "@/components/ui/mizu/tilt";
import { Frame } from "@/components/ui/mizu/frame";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 motion/Tilt.tsx
Source is included in the npm package under src/motion/Tilt.tsx.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| max | number | 6 | Maximum tilt in degrees, clamped to 0–20. |
| children / className | ReactNode / string | — | Surface content and styling. |
Accessibility
Pointer-mouse enhancement only. Touch and keyboard receive a stable surface; no essential information is pointer-dependent.
Motion
Motion springs settle on leave. Reduced motion disables rotation.