Resizable
Accessible resizable panel groups and layouts with keyboard support. Built for React applications with Next.js integration and TypeScript support.
Ever used VS Code or any dev tool where you can drag to resize the sidebar? That's what resizable panels do - they let users adjust the layout to fit their workflow. No more fixed layouts that work for nobody.
Nested resizable panels
Drag the handles to resize panels in any direction:
Built on react-resizable-panels with full keyboard support and proper ARIA attributes. This free open source React component handles all the drag mechanics, constraints, and persistence while you focus on the content.
npx shadcn@latest add resizable
Why resizable panels are game changers
Fixed layouts are nobody's friend. Resizable panels let users work how they want:
- User-controlled layout - Everyone gets their perfect setup
- Responsive by default - Panels adapt to available space
- Keyboard accessible - Arrow keys for fine control
- Persistence ready - Save layouts to localStorage
- Smooth dragging - No janky movements or flickering
- Constraint support - Set min/max sizes that make sense
Useful resizable patterns
Code editor layout
Classic IDE-style layout with file tree and editor:
Dashboard with collapsible sidebar
Sidebar that can collapse to icons or expand for full navigation:
Three column layout
Email client style with list and detail views:
These patterns show up in the best tools because they let users work efficiently. Code editors where you can hide the file tree, dashboards where the sidebar gets out of the way, email clients where you can focus on what matters.
Perfect for productivity apps
Works great anywhere users spend real time - admin panels, dashboards, editors, email clients, data tools. The kind of apps where people have workflows and preferences.
Drops right into Next.js projects. Full TypeScript support. Styled with Tailwind CSS to match the shadcn design system.
Built on react-resizable-panels
Uses bvaughn's react-resizable-panels under the hood, which is battle-tested:
- Constraint system - Min/max sizes that respect each other
- Collapse support - Panels can collapse to zero
- Persistence - Save and restore layouts
- Keyboard control - Full keyboard navigation
- Touch support - Works on tablets and touch devices
- Performance optimized - Smooth even with complex layouts
API Reference
ResizablePanelGroup
Container that manages panel layout and drag state.
Prop | Type | Default | Description |
---|---|---|---|
className | string | - | Additional CSS classes |
direction | "horizontal" | "vertical" | "horizontal" | Panel arrangement direction |
autoSaveId | string | - | ID for localStorage persistence |
storage | PanelGroupStorage | - | Custom storage implementation |
onLayout | (sizes: number[]) => void | - | Called when layout changes |
ResizablePanel
Individual panel within a group.
Prop | Type | Default | Description |
---|---|---|---|
className | string | - | Additional CSS classes |
defaultSize | number | - | Initial size as percentage |
minSize | number | 0 | Minimum size as percentage |
maxSize | number | 100 | Maximum size as percentage |
collapsible | boolean | false | Can collapse to zero |
collapsedSize | number | 0 | Size when collapsed |
onCollapse | () => void | - | Called when panel collapses |
onExpand | () => void | - | Called when panel expands |
ResizableHandle
Draggable divider between panels.
Prop | Type | Default | Description |
---|---|---|---|
className | string | - | Additional CSS classes |
withHandle | boolean | false | Show visible drag handle |
disabled | boolean | false | Disable dragging |
Keyboard Navigation
Key | Action |
---|---|
Tab | Focus next handle |
Enter | Enter keyboard resize mode |
Arrow Left/Up | Shrink left/top panel by 10px |
Arrow Right/Down | Grow left/top panel by 10px |
Shift + Arrows | Resize by 1px (fine control) |
Home | Resize to minimum size |
End | Resize to maximum size |
Escape | Exit keyboard resize mode |
Common Patterns
Pattern | Use Case | Configuration |
---|---|---|
Fixed sidebar | Navigation that stays consistent | minSize={15} maxSize={15} |
Collapsible panel | Hide when not needed | collapsible={true} collapsedSize={5} |
50/50 split | Equal starting point | defaultSize={50} on both |
Golden ratio | Pleasing proportions | defaultSize={62} and 38 |
Persistent layout | Remember user preference | autoSaveId="my-layout" |
Make resizable panels feel right
Keep these in mind when building with resizable panels:
- Set sensible defaults - Start with a layout that works for most
- Respect minimums - Don't let panels get too small to be useful
- Make handles obvious - Users need to know they can drag
- Consider mobile - Maybe disable resizing on small screens
- Add collapse buttons - Not everyone finds the drag handles
- Save user layouts - People hate redoing their setup
- Test with content - Make sure panels work with real data
- Provide presets - Quick buttons for common layouts
Radio Group
A set of checkable buttons where only one can be selected at a time. Built for React applications with Next.js integration and TypeScript support.
Scroll Area
Augments native scroll functionality for custom, cross-browser styling. Built for React applications with Next.js integration and TypeScript support.