nook
Browse the docs

Components

Tilt card

Native

A shallow perspective card that leans with the mouse and rests flat for keyboard input.

See the prompt
Member since 2024

The reading room

Your place for good books and better conversations.

Maya Chen

Installation

npx nook-ui@latest add tilt-card

Prompt

Paste this into your AI coding assistant. It adds this exact component, the same way the CLI does, and tells the assistant how to use it.

Short. For assistants that can run commands in your project.

Plain text
Add the Nook "Tilt card" component to this project, exactly as Nook ships it.

A shallow perspective card that leans with the mouse and rests flat for keyboard input.

Steps
1. Check for `nook.json` in the project root. If it is missing, run `npx nook-ui@latest init` first (React or Next.js with Tailwind CSS v4). It adds the Nook tokens, the theme and `cn()`.
2. Run `npx nook-ui@latest add tilt-card`. It writes `components/ui/tilt-card.tsx` together with everything the component needs. Do not write the component from memory.
3. If you cannot run commands, fetch http://localhost:3000/r/tilt-card.json, write every entry of `files` to the path it names, install the packages in `dependencies`, and repeat for each name in `registryDependencies`.
4. Use it where I ask. Start from this example:

```tsx
import { TiltCard } from "@/components/ui/tilt-card";
import { Button } from "@/components/ui/button";
export default function TiltCardDefault() {
 return <TiltCard className="grid w-full max-w-sm gap-5"><div className="flex items-center justify-between"><span className="size-3 bg-brand" /><span className="text-xs text-muted-foreground">Member since 2024</span></div><div><h3 className="text-2xl font-semibold tracking-tight">The reading room</h3><p className="mt-2 text-sm text-muted-foreground">Your place for good books and better conversations.</p></div><div className="flex items-center justify-between border-t border-border pt-4"><span className="text-sm">Maya Chen</span><Button variant="outline" size="sm">View membership</Button></div></TiltCard>;
}
```

API
- `TiltCard`: A shallow perspective card that leans with the mouse and rests flat for keyboard input.
  - `strength` (`number`): Maximum pointer tilt range in degrees. Defaults to 8.
  - `children` (`ReactNode`): Card content and any normal controls.

Rules
- Colors, radii, shadows and motion come from Nook tokens and classes such as `bg-primary`, `text-muted-foreground`, `border-border`, `rounded-lg` and `h-control`. Never hard-code them.
- Do not restyle or simplify the file. Change how it looks through `className`, its props and the theme.
- It must keep working with the keyboard, in light and dark mode, and in the sharp, soft and bold styles.
- Accessibility: Decoration never changes content order. Touch, keyboard focus and reduced motion keep the card flat. Pointer cancellation resets it.

Done when the component renders like the example in light and dark mode and the project type-checks.

Usage

import { TiltCard } from "@/components/ui/tilt-card";
import { Button } from "@/components/ui/button";
export default function TiltCardDefault() {
 return <TiltCard className="grid w-full max-w-sm gap-5"><div className="flex items-center justify-between"><span className="size-3 bg-brand" /><span className="text-xs text-muted-foreground">Member since 2024</span></div><div><h3 className="text-2xl font-semibold tracking-tight">The reading room</h3><p className="mt-2 text-sm text-muted-foreground">Your place for good books and better conversations.</p></div><div className="flex items-center justify-between border-t border-border pt-4"><span className="text-sm">Maya Chen</span><Button variant="outline" size="sm">View membership</Button></div></TiltCard>;
}

Examples

Gentle and strong

Gentle tilt

Move your pointer across the card.

Strong tilt

Move your pointer across the card.

Event ticket

Admit one

Design Systems Day

March 14, 2027 · Hall B

NK-0427-18

Props

TiltCard

A shallow perspective card that leans with the mouse and rests flat for keyboard input.

PropTypeDefaultDescription
strengthnumber–Maximum pointer tilt range in degrees. Defaults to 8.
childrenReactNode–Card content and any normal controls.

Accessibility

Decoration never changes content order. Touch, keyboard focus and reduced motion keep the card flat. Pointer cancellation resets it.

Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.