Components
Dock
NativeAn app launcher that magnifies nearby buttons as the pointer passes.
A little space for your daily essentials.
Home workspace
Installation
npx nook-ui@latest add dockPrompt
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 "Dock" component to this project, exactly as Nook ships it.
An app launcher that magnifies nearby buttons as the pointer passes.
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 dock`. It writes `components/ui/dock.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/dock.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
"use client";
import * as React from "react";
import { Dock } from "@/components/ui/dock";
import { CalendarIcon, SearchIcon, HomeIcon, MailIcon, SettingsIcon } from "@/components/icons";
export default function DockDefault() {
const [app,setApp] = React.useState('Home');
return <div className="grid justify-items-center gap-4"><p className="text-sm text-muted-foreground">A little space for your daily essentials.</p><Dock items={[["Home",HomeIcon],["Search",SearchIcon],["Mail",MailIcon],["Calendar",CalendarIcon],["Settings",SettingsIcon]].map(([label,Icon]) => ({id:label as string,label:label as string,icon:React.createElement(Icon as typeof HomeIcon),onSelect:()=>setApp(label as string)}))} /><p role="status" className="text-sm">{app} workspace</p></div>;
}
```
API
- `Dock`: An app launcher that magnifies nearby buttons as the pointer passes.
- `items` (`DockItem[]`): Stable id, label, icon and optional onSelect callback for each app.
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: One toolbar tab stop. Arrow keys, Home and End move focus; Enter or Space activates. Every icon has a text name. Keyboard focus stays still.
Done when the component renders like the example in light and dark mode and the project type-checks.Usage
"use client";
import * as React from "react";
import { Dock } from "@/components/ui/dock";
import { CalendarIcon, SearchIcon, HomeIcon, MailIcon, SettingsIcon } from "@/components/icons";
export default function DockDefault() {
const [app,setApp] = React.useState('Home');
return <div className="grid justify-items-center gap-4"><p className="text-sm text-muted-foreground">A little space for your daily essentials.</p><Dock items={[["Home",HomeIcon],["Search",SearchIcon],["Mail",MailIcon],["Calendar",CalendarIcon],["Settings",SettingsIcon]].map(([label,Icon]) => ({id:label as string,label:label as string,icon:React.createElement(Icon as typeof HomeIcon),onSelect:()=>setApp(label as string)}))} /><p role="status" className="text-sm">{app} workspace</p></div>;
}Examples
Two items
Five apps
Props
Dock
An app launcher that magnifies nearby buttons as the pointer passes.
| Prop | Type | Default | Description |
|---|---|---|---|
| items | DockItem[] | – | Stable id, label, icon and optional onSelect callback for each app. |
Accessibility
One toolbar tab stop. Arrow keys, Home and End move focus; Enter or Space activates. Every icon has a text name. Keyboard focus stays still.
Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.