Components
Coverflow
NativeA perspective shelf of covers with explicit, hand-controlled navigation.
Nook editionsQuiet hours
2 / 3
Quiet hours
Essays on a slower kind of work.
Installation
npx nook-ui@latest add coverflowPrompt
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.
Add the Nook "Coverflow" component to this project, exactly as Nook ships it.
A perspective shelf of covers with explicit, hand-controlled navigation.
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 coverflow`. It writes `components/ui/coverflow.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/coverflow.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 { Coverflow } from "@/components/ui/coverflow";
export default function CoverflowDefault() {
const books = [{id:'field',title:'Field notes',description:'A guide to noticing more.',color:'bg-brand text-brand-foreground'}, {id:'quiet',title:'Quiet hours',description:'Essays on a slower kind of work.',color:'bg-primary text-primary-foreground'}, {id:'form',title:'A useful form',description:'Objects with a reason to exist.',color:'bg-secondary text-secondary-foreground'}];
return <Coverflow className="w-full max-w-md" defaultValue={1} items={books.map(book => ({...book,cover:<div className={`flex h-full flex-col justify-between p-5 ${book.color}`}><span className="text-xs opacity-100">Nook editions</span><strong className="text-2xl leading-tight tracking-tight">{book.title}</strong><span className="grid grid-cols-3 gap-1 self-start">{Array.from({length:9},(_,i)=><span key={i} className="size-2 bg-current opacity-50" />)}</span></div>}))} />;
}
```
API
- `Coverflow`: A perspective shelf of covers with explicit, hand-controlled navigation.
- `items` (`CoverflowItem[]`): Cover nodes, ids, titles and descriptions.
- `value / defaultValue` (`number`): Controlled or initial selected index.
- `onValueChange` (`(index: number) => void`): Called when selection changes.
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: The shelf supports arrows, Home and End, with visible previous/next buttons. Inactive covers are inert. The selected title and description are announced. No autoplay.
Done when the component renders like the example in light and dark mode and the project type-checks.Usage
import { Coverflow } from "@/components/ui/coverflow";
export default function CoverflowDefault() {
const books = [{id:'field',title:'Field notes',description:'A guide to noticing more.',color:'bg-brand text-brand-foreground'}, {id:'quiet',title:'Quiet hours',description:'Essays on a slower kind of work.',color:'bg-primary text-primary-foreground'}, {id:'form',title:'A useful form',description:'Objects with a reason to exist.',color:'bg-secondary text-secondary-foreground'}];
return <Coverflow className="w-full max-w-md" defaultValue={1} items={books.map(book => ({...book,cover:<div className={`flex h-full flex-col justify-between p-5 ${book.color}`}><span className="text-xs opacity-100">Nook editions</span><strong className="text-2xl leading-tight tracking-tight">{book.title}</strong><span className="grid grid-cols-3 gap-1 self-start">{Array.from({length:9},(_,i)=><span key={i} className="size-2 bg-current opacity-50" />)}</span></div>}))} />;
}Examples
Albums
1 / 4
Low tide
Kei Tanaka, 2024
Two items
$19
1 / 2
Monthly
Pay as you go
Props
Coverflow
A perspective shelf of covers with explicit, hand-controlled navigation.
| Prop | Type | Default | Description |
|---|---|---|---|
| items | CoverflowItem[] | – | Cover nodes, ids, titles and descriptions. |
| value / defaultValue | number | – | Controlled or initial selected index. |
| onValueChange | (index: number) => void | – | Called when selection changes. |
Accessibility
The shelf supports arrows, Home and End, with visible previous/next buttons. Inactive covers are inert. The selected title and description are announced. No autoplay.
Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.