Caprice LogoCaprice UI

Resizable

A component for building resizable panel groups and layouts.

Installation

npx shadcn@latest add @caprice/resizable

Usage

import * as Resizable from "@/components/caprice-ui/resizable"

Examples

Vertical

Handle

Nested Group

Collapsible

Differences with shadcn/ui

If you're familiar with shadcn/ui, most patterns will carry over. This guide points out the differences so you can start using Caprice UI without surprises.

Key changes

Featureshadcn/uiCaprice UI
Import styleIndividual named importsNamespace import (* as Resizable)
Group componentResizablePanelGroupResizable.Group
Panel componentResizablePanelResizable.Panel
Handle componentResizableHandleResizable.Separator
Orientation propdirectionorientation
Orientation detectiondata-[panel-group-direction=vertical]aria-[orientation=horizontal]
Data slot (group)resizable-panel-groupresizable-group
Data slot (handle)resizable-handleresizable-separator
Type exportsRegular typesNamespace types (Group.Props, Panel.Props, Separator.Props)

The component is renamed from "Handle" to "Separator" to align with the ARIA separator role, which is the semantic role used by react-resizable-panels for keyboard accessibility.

Comparison Example

shadcn/ui
import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from '@/components/ui/resizable';

<ResizablePanelGroup direction="horizontal">
  <ResizablePanel defaultSize={25}>Sidebar</ResizablePanel>
  <ResizableHandle withHandle />
  <ResizablePanel defaultSize={75}>Content</ResizablePanel>
</ResizablePanelGroup>
Caprice UI
import * as Resizable from '@/components/caprice-ui/resizable';

<Resizable.Group orientation="horizontal">
  <Resizable.Panel defaultSize={25}>Sidebar</Resizable.Panel>
  <Resizable.Separator withHandle />
  <Resizable.Panel defaultSize={75}>Content</Resizable.Panel>
</Resizable.Group>

Accessibility

  • Keyboard navigation: Separators can be focused and resized using arrow keys, following the ARIA separator pattern.
  • ARIA orientation: The component uses aria-orientation to communicate the resize direction to assistive technologies.
  • Focus indicator: Separators display a visible focus ring when focused via keyboard.

Panel

Separator