Resizable

A resizable component that allows users to resize panels in a layout. Built with accessibility and keyboard support in mind using react-resizable-panels.

Sidebar
Main Content

Installation

Install the component using the Tailgrids CLI.

npx @tailgrids/cli add resizable

Anatomy

Import the component parts and combine them.

import {
  ResizableHandle,
  ResizablePanel,
  ResizablePanelGroup
} from "@/components/resizable";

export const ResizableExample = () => (
  <ResizablePanelGroup direction="horizontal">
    <ResizablePanel>One</ResizablePanel>
    <ResizableHandle />
    <ResizablePanel>Two</ResizablePanel>
  </ResizablePanelGroup>
);

Examples

Vertical

Set the orientation prop to vertical to create a vertical layout.

Header
Content

Visible Handle

Use the withHandle prop on ResizableHandle to show a more visible grabber.

Sidebar
Main Content

Nested

You can nest ResizablePanelGroup components to create complex layouts.

Sidebar
Top Content
Bottom Content

API Reference

ResizablePanelGroup

The main container for resizable panels.

PropTypeDefaultDescription
orientation"horizontal" | "vertical"-The direction of the panels.
idstring-Unique ID for the panel group.
storagePanelGroupStorage-Custom storage for panel sizes.
classNamestring-Additional CSS classes.

ResizablePanel

A single panel within a group.

PropTypeDefaultDescription
defaultSizenumber-The initial size of the panel (0-100).
maxSizenumber-The maximum size of the panel (0-100).
minSizenumber-The minimum size of the panel (0-100).
collapsiblebooleanfalseWhether the panel can be collapsed.
onCollapse() => void-Callback when the panel collapses.
onExpand() => void-Callback when the panel expands.
onResize(size: number) => void-Callback when the panel is resized.

ResizableHandle

The separator between panels that users can drag.

PropTypeDefaultDescription
withHandlebooleanfalseShows a visible handle icon.
disabledbooleanfalseDisables resizing.
classNamestring-Additional CSS classes.

Accessibility

  • Full keyboard support for resizing using arrow keys.
  • Home/End keys to quickly jump to min/max sizes.
  • Proper ARIA attributes for screen readers.
  • Focus management for handles.