Skip to content
loseta

Components / Surfaces

Resizable

A flex layout with draggable separator handles.

Status stable

Sidebar

Content

<div class="resizable" style="height: 10rem">
  <div class="resizable-panel">
    <p><strong>Sidebar</strong></p>
  </div>
  <div data-slot="handle" role="separator" aria-orientation="vertical" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100" tabindex="0"></div>
  <div class="resizable-panel">
    <p><strong>Content</strong></p>
  </div>
</div>

Installation

pnpm dlx loseta add resizable
npx loseta add resizable

Examples

Horizontal

Panel one

Drag the handle or use the arrow keys in your application.

Panel two

Set --panel-size to change the initial flex ratio.

<div class="resizable" data-orientation="horizontal" style="height: 12rem">
  <div class="resizable-panel">
    <p><strong>Panel one</strong></p>
    <p>Drag the handle or use the arrow keys in your application.</p>
  </div>
  <div data-slot="handle" role="separator" aria-orientation="vertical" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100" tabindex="0"></div>
  <div class="resizable-panel" style="--panel-size: 2">
    <p><strong>Panel two</strong></p>
    <p>Set --panel-size to change the initial flex ratio.</p>
  </div>
</div>

Vertical

Top panel

Bottom panel

<div class="resizable" data-orientation="vertical" style="height: 14rem">
  <div class="resizable-panel">
    <p><strong>Top panel</strong></p>
  </div>
  <div data-slot="handle" role="separator" aria-orientation="horizontal" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100" tabindex="0"></div>
  <div class="resizable-panel">
    <p><strong>Bottom panel</strong></p>
  </div>
</div>

Accessibility and behavior

  • Flex layout with panels sized by --panel-size flex-grow. Handles use role="separator" with aria-orientation and aria-valuenow/min/max; drag and keyboard resizing are consumer JavaScript.

Files

components/resizable.cssbase
styles/nova/resizable.cssstyle

Install contract

The CLI writes the base file under components/, the visual file for the selected style under styles/<name>/, and any primitive dependency underprimitives/. The generated index.css imports them in the right layer order.

← Back to components

loseta is MIT licensed. Built with native CSS, no runtime. Inspired byshadcn/ui.