Components
Resizable
NativeTwo panels separated by a pointer and keyboard resize handle.
Use arrow keys to resize. Hold Shift for larger changes. Home and End reach the limits.
Installation
npx nook-ui@latest add resizablePrompt
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 "Resizable" component to this project, exactly as Nook ships it.
Two panels separated by a pointer and keyboard resize handle.
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 resizable`. It writes `components/ui/resizable.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/resizable.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 { Resizable } from "@/components/ui/resizable";
export default function Example() {
return (
<Resizable
className="w-full"
defaultValue={35}
panelLabels={["Project files", "File details"]}
>
<div>
<h3 className="mb-3 text-sm font-semibold">Project files</h3>
<ul className="grid gap-3 text-sm text-muted-foreground">
<li>Brand guidelines</li>
<li>Product photography</li>
<li>Launch checklist</li>
<li>Campaign copy</li>
</ul>
</div>
<div>
<h3 className="text-sm font-semibold">Brand guidelines</h3>
<p className="mt-3 text-sm text-muted-foreground">
The latest visual identity, type scale and writing guidelines for
everyone working on the autumn launch.
</p>
<p className="mt-4 text-xs text-muted-foreground">
Updated by Amelia · November 15
</p>
</div>
</Resizable>
);
}
```
API
- `Resizable`: Two panels separated by a pointer and keyboard resize handle.
- `children` (`[ReactNode, ReactNode]`): Content for the two panels.
- `value / defaultValue` (`number`, default 50): First panel percentage.
- `onValueChange` (`(percent: number) => void`): Receives resized percentage.
- `min / max` (`number`, default 15 / 85): First panel bounds.
- `orientation` (`horizontal | vertical`, default horizontal): Panel layout direction.
- `panelLabels` (`[string, string]`): Accessible names for both scrolling panels.
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: Focusable separator exposes bounds and percentage; arrows, Shift, Home and End resize it.
Done when the component renders like the example in light and dark mode and the project type-checks.Usage
import { Resizable } from "@/components/ui/resizable";
export default function Example() {
return (
<Resizable
className="w-full"
defaultValue={35}
panelLabels={["Project files", "File details"]}
>
<div>
<h3 className="mb-3 text-sm font-semibold">Project files</h3>
<ul className="grid gap-3 text-sm text-muted-foreground">
<li>Brand guidelines</li>
<li>Product photography</li>
<li>Launch checklist</li>
<li>Campaign copy</li>
</ul>
</div>
<div>
<h3 className="text-sm font-semibold">Brand guidelines</h3>
<p className="mt-3 text-sm text-muted-foreground">
The latest visual identity, type scale and writing guidelines for
everyone working on the autumn launch.
</p>
<p className="mt-4 text-xs text-muted-foreground">
Updated by Amelia · November 15
</p>
</div>
</Resizable>
);
}Examples
Vertical
Use arrow keys to resize. Hold Shift for larger changes. Home and End reach the limits.
With limits
Use arrow keys to resize. Hold Shift for larger changes. Home and End reach the limits.
Controlled
Preview pane: 40%
Use arrow keys to resize. Hold Shift for larger changes. Home and End reach the limits.
Props
Resizable
Two panels separated by a pointer and keyboard resize handle.
| Prop | Type | Default | Description |
|---|---|---|---|
| children | [ReactNode, ReactNode] | – | Content for the two panels. |
| value / defaultValue | number | 50 | First panel percentage. |
| onValueChange | (percent: number) => void | – | Receives resized percentage. |
| min / max | number | 15 / 85 | First panel bounds. |
| orientation | horizontal | vertical | horizontal | Panel layout direction. |
| panelLabels | [string, string] | – | Accessible names for both scrolling panels. |
Accessibility
Focusable separator exposes bounds and percentage; arrows, Shift, Home and End resize it.
Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.