Talisman LogoTalisman Logo Design System
Browse documentation
Components

Resizable

Panels that share one area and that the user resizes by dragging a handle or with the arrow keys.

Stableimport { ResizablePanelGroup } from "@repo/ui/resizable";Source

Arraste a alça para ajustar o espaço de cada painel.

O painel ao lado cede espaço quando este cresce.

direction
<ResizablePanelGroup direction="horizontal" />

Drag the handle, or focus it and use the arrow keys.

When to use

  • Master-detail views where people need more room for one side now and the other later, such as a document tree next to a viewer.
  • Workspaces where the user compares two things side by side: the petition and the contestação.
  • Panels whose useful width depends on the monitor, which fits our range of older and varied screens.

When not to use

  • A fixed split. Use a grid or flex layout with set widths. A handle people never need is clutter.
  • Content that hides and shows on demand. Use Collapsible, Sheet or Drawer.
  • A line between two blocks. Use Separator.
  • Small screens. Panels need space. Stack the content instead.

Anatomy

Part Role
ResizablePanelGroup Lays out the panels in a direction and fills its parent (h-full w-full).
ResizablePanel One panel. Sizes are percentages of the group.
ResizableHandle The divider between two panels. Add withHandle to show a grip.

Always place a handle between two panels, and give the group a parent with an explicit height. Without a height the group has nothing to fill.

Examples

Horizontal

Panels side by side, with the grip so the handle is easy to find.

Petição inicial, procuração e comprovantes do cliente.

Conteúdo da petição inicial do processo 0001234-56.2024.8.26.0100.

Vertical

Texto da contestação em edição.

Marina Costa: revisar o argumento sobre prescrição.

Size limits

Set minSize and maxSize on every panel so neither can disappear. A collapsible panel snaps closed when dragged under its minimum.

Entre 15% e 40% da largura. Arraste além do mínimo para recolher.

Esta área ocupa o espaço que sobrar.

Three panels

Handles without a grip keep a quiet look when the layout has several panels.

Fila do revisor.

Documento em revisão.

Eventos do processo.

Content

  • Name each panel with a short heading: “Documentos”, “Visualização”.
  • Pick default sizes that work before the user touches anything. Most people never resize.
  • Put the content people need first in the larger panel.

Do and don’t

Nunca fica menor que 20%.

Nunca fica menor que 30%.

DoSet a minimum size, so each panel stays usable.

Pode ser arrastado até desaparecer.

Pode ser arrastado até desaparecer.

Don'tDon't leave the size free. A panel dragged to zero looks like a bug and is hard to recover.

Accessibility

  • Built on react-resizable-panels. The handle has role="separator" with aria-valuenow, aria-valuemin and aria-valuemax, and it is focusable.
  • Keyboard: arrow keys resize by a step, Home and End go to the limits, and Enter collapses or expands a collapsible panel.
  • The handle has no accessible name by default. Pass aria-label (“Redimensionar painel de documentos”) through its props.
  • The handle shows a focus ring on focus-visible.
  • The panels keep their reading order, so assistive technology reads them first to last.
  • Changing the layout does not announce anything. Do not use panel size to carry information.

Code

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

<div className="h-[32rem] overflow-hidden rounded-lg border border-primary">
  <ResizablePanelGroup direction="horizontal">
    <ResizablePanel defaultSize={35} minSize={20} maxSize={55}>
      <DocumentTree />
    </ResizablePanel>
    <ResizableHandle aria-label="Redimensionar documentos" withHandle />
    <ResizablePanel defaultSize={65} minSize={30}>
      <DocumentViewer />
    </ResizablePanel>
  </ResizablePanelGroup>
</div>;

Props

ResizablePanelGroup
PropTypeDefaultDescription
autoSaveIdstring—Saves the layout in localStorage under this id and restores it on the next visit
direction"horizontal" | "vertical"—`horizontal` places panels side by side, `vertical` stacks them
onLayout(sizes: number[]) => void—Called with the panel sizes (percentages) after each change
ResizablePanel
PropTypeDefaultDescription
defaultSizenumber—Initial size as a percentage of the group.
minSizenumber10Smallest size, in percent.
maxSizenumber100Largest size, in percent.
collapsiblebooleanfalseLets the panel snap closed when dragged below `minSize`.
collapsedSizenumber0Size in percent when collapsed.
onResize(size: number, prevSize: number | undefined) => void—Called when the panel size changes.
id / orderstring / number—Set both when panels render conditionally, so the group can match saved layouts.
ResizableHandle
PropTypeDefaultDescription
withHandlebooleanfalseShows a grip icon on the divider.
disabledbooleanfalseBlocks dragging and the keyboard.
onDragging(isDragging: boolean) => void—Called when dragging starts and stops.

Known issues

Issue Effect
The handle line is 1px wide, with a 4px hit area (after:w-1). Below the 24px minimum. The handle is hard to grab with a mouse, and harder for people with motor limits.
The focus ring uses ring-focus, and the preset has no focus ring color (only stroke-focus). The ring falls back to Tailwind’s default translucent blue, not the focus token.
The handle has no accessible name and the grip icon has no label. Screen readers announce an unnamed separator unless the app passes aria-label.
ResizablePanelGroup is h-full w-full. A parent without a height gives a group of zero height and nothing is visible.
Edit this page on GitHub