Components
Scroll area
NativeA labelled native scroll container with keyboard focus and themed scrollbars.
What shipped this week
Installation
npx nook-ui@latest add scroll-areaPrompt
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 "Scroll area" component to this project, exactly as Nook ships it.
A labelled native scroll container with keyboard focus and themed scrollbars.
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 scroll-area`. It writes `components/ui/scroll-area.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/scroll-area.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 { ScrollArea } from "@/components/ui/scroll-area";
const releases = [
"Faster search across archived projects",
"Export reports as a spreadsheet",
"Invite reviewers without a paid seat",
"Set a default timezone for your team",
"Restore recently deleted files",
"Pin the views you use every morning",
"New keyboard shortcuts for the inbox",
"More control over email digests",
];
export default function Example() {
return (
<div className="w-full max-w-md">
<h3 className="mb-3 font-semibold">What shipped this week</h3>
<ScrollArea
aria-label="Release notes"
className="h-52 border-(length:--edge) border-(--surface-edge) bg-card p-inset"
>
<ol className="divide-y divide-border">
{releases.map((release, i) => (
<li key={release} className="py-3 first:pt-0">
<span className="text-xs text-muted-foreground">
November {15 - i}, 2026
</span>
<p className="mt-1 text-sm font-medium">{release}</p>
</li>
))}
</ol>
</ScrollArea>
</div>
);
}
```
API
- `ScrollArea`: A labelled native scroll container with keyboard focus and themed scrollbars.
- `aria-label` (`string`): Required name for the scrolling region.
- `orientation` (`"vertical" | "horizontal" | "both"`, default "both"): Which way it scrolls. Horizontal also turns the mouse wheel into sideways scrolling and keeps the page scrolling once the row reaches either end.
- `children` (`ReactNode`): Content to scroll.
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: A named region receives focus so arrow and page keys can scroll it.
Done when the component renders like the example in light and dark mode and the project type-checks.Usage
import { ScrollArea } from "@/components/ui/scroll-area";
const releases = [
"Faster search across archived projects",
"Export reports as a spreadsheet",
"Invite reviewers without a paid seat",
"Set a default timezone for your team",
"Restore recently deleted files",
"Pin the views you use every morning",
"New keyboard shortcuts for the inbox",
"More control over email digests",
];
export default function Example() {
return (
<div className="w-full max-w-md">
<h3 className="mb-3 font-semibold">What shipped this week</h3>
<ScrollArea
aria-label="Release notes"
className="h-52 border-(length:--edge) border-(--surface-edge) bg-card p-inset"
>
<ol className="divide-y divide-border">
{releases.map((release, i) => (
<li key={release} className="py-3 first:pt-0">
<span className="text-xs text-muted-foreground">
November {15 - i}, 2026
</span>
<p className="mt-1 text-sm font-medium">{release}</p>
</li>
))}
</ol>
</ScrollArea>
</div>
);
}Examples
Horizontal
Chat log
Both axes
A wide table
Props
ScrollArea
A labelled native scroll container with keyboard focus and themed scrollbars.
| Prop | Type | Default | Description |
|---|---|---|---|
| aria-label | string | – | Required name for the scrolling region. |
| orientation | "vertical" | "horizontal" | "both" | "both" | Which way it scrolls. Horizontal also turns the mouse wheel into sideways scrolling and keeps the page scrolling once the row reaches either end. |
| children | ReactNode | – | Content to scroll. |
Accessibility
A named region receives focus so arrow and page keys can scroll it.
Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.