No results found

Resizable

A draggable divider that allows users to adjust the size of adjacent sections.

Left Content (min: 100, max: 500)
Right Content (min: 150)

When to use Resizable

Resizable is ideal when:

Real-world examples:

Features

  • WAI ARIA Separator pattern implementation
  • Keyboard navigation with arrow keys and Home/End
  • Collapsible contents with custom thresholds
  • Responsive resizing with min/max constraints
  • Content size synchronization across handles
  • Dynamic orientation (horizontal/vertical)
  • Fine-grained resizing control with Shift key
  • Progressive size adjustments with step values
  • Custom collapse/expand behaviors with callbacks
  • Flexible initial sizing with auto-distribution
  • Accessible resize handles with ARIA attributes

Anatomy

PartDescription
<Resizable.Root>Container component that manages the resizable layout and state
<Resizable.Content>Individual content component that can be resized
<Resizable.Handle>Interactive handle component for resizing adjacent contents

Examples

Basic Usage

Start with this example if you're new to Resizable. It shows the minimal setup needed for a functional component.

Left Content (min: 100, max: 500)
Right Content (min: 150)

This example demonstrates:

<Resizable.Root>
  <Resizable.Content width={200} minWidth={100} maxWidth={500}>
    <div>Left Content</div>
  </Resizable.Content>
  <Resizable.Handle />
  <Resizable.Content minWidth={150}>
    <div>Right Content</div>
  </Resizable.Content>
</Resizable.Root>

Vertical Layout

Change the resize direction to vertical for stacked layouts.

Header
Main Content
Footer

Collapsible Content

Enable content collapsing with customizable thresholds and sizes.

Collapsible Content (min: 150, collapsed: 50)
Regular Content (min: 200)

This demonstrates:

Nested Layouts

Create complex layouts by nesting resizable components.

Left Content
Top Content
Bottom Content

State Management

Track and respond to content size changes.

Left Panel (min: 100, max: 500)
Right Panel (min: 150)

Disabled State

Prevent resizing when needed.

Left Content (min: 100, max: 500)
Right Content (min: 150)

Keyboard Navigation

The component supports full keyboard interaction:

Accessibility

Built following the WAI-ARIA window splitter pattern, including:

Styling

The component uses data attributes for styling:

[data-qds-resizable-root] {
  /* Root styles */
}

[data-qds-resizable-handle][data-dragging="true"] {
/* Handle drag state */
}

[data-qds-resizable-content][data-collapsed="true"] {
/* Collapsed content state */
}

API Reference

Resizable Content

Inherits from: <div />

Props

PropTypeDefaultDescription
widthnumber-
heightnumber-
minWidthnumber-
maxWidthnumber-
minHeightnumber-
maxHeightnumber-
collapsibleboolean-
collapsedboolean-
collapsedSizenumber-
collapseThresholdnumber-
onResize$QRL<(size: number) => void>-
onCollapse$QRL<() => void>-
onExpand$QRL<() => void>-

Data Attributes

AttributeDescription
data-orientationThe orientation of the content
data-min-sizeMinimum size constraint for the content
data-max-sizeMaximum size constraint for the content
data-collapsibleIndicates whether the content is collapsible
data-collapsed-sizeSize when content is collapsed
data-collapse-thresholdThreshold for triggering collapse
data-is-collapsedCurrent collapsed state of the content

Resizable Root

Inherits from: <div />

Props

PropTypeDefaultDescription
orientation"horizontal" | "vertical"-
disabledboolean-
storageKeystring-

Data Attributes

AttributeDescription
data-orientationThe orientation of the resizable container
data-disabledIndicates whether resizing is disabled

Resizable Handle

Inherits from: <button />

Data Attributes

AttributeDescription
data-orientationThe orientation of the handle
data-draggingIndicates whether the handle is being dragged
data-disabledIndicates whether the handle is disabled