Navigated to /docs/ui/components/resizable

Resizable

Resizable region with pointer dragging, keyboard adjustment, size limits, and preview and commit callbacks.

Preview

A live, theme-aware example rendered with the published component.

Loading preview…

Import

Import from the focused entry point below, or use the same named export from @tavojs/ui. Both are public APIs; measure the built application when comparing their bundle cost.

TSX
tsximport { Resizable } from "@tavojs/ui/resizable";

The component import loads compiled component CSS. Enable tavoUi() for your project theme variables, or import @tavojs/ui/theme.css once for the package default theme. The equivalent CSS-safe component alias is @tavojs/ui/css/resizable.

When to use

Use it when

Use Resizable for an inspector or panel whose width or height can change. Set a meaningful initial size and limits, and use onValueChange to persist the committed size.

Choose something else when

Use SplitPane for a fixed two-region layout. Resizable changes its own root size; the surrounding layout and persistence remain application responsibilities.

Examples

These examples include imports and local state where interaction requires it. Render the exported component in a page after completing UI installation. Demo state stays in the mounted component; connect file handling, persistence, and data loading to your application as needed.

Resizable example

TSXCreate: src/components/examples/ResizableExample1.tsx
tsximport { createTavo } from "@tavojs/core";
import { Resizable } from "@tavojs/ui/resizable";
import { Text } from "@tavojs/ui";

type State = { width: number };

export const ResizableExample1 = createTavo<Record<string, never>, State>({
  model: () => ({ width: 320 }),
  view: ({ state, model }) => (
    <>
      <Resizable
        orientation="vertical"
        value={state.width}
        min={260}
        max={560}
        step={8}
        onValueChange={(width) => model.set("width", width)}
      >
        <Resizable.Panel><Text>Inspector width: {state.width}px</Text></Resizable.Panel>
        <Resizable.Handle aria-label="Resize inspector" />
      </Resizable>
    </>
  )
});

Common props and defaults

A curated starting point. The complete TypeScript API below includes additional props and compound member contracts.

PropTypeDefaultDescription
classNamestring

Optional class hook applied to the public root element owned by the component.
direction"horizontal" | "vertical"

Configures direction for this component.
orientation"horizontal" | "vertical"

Separator orientation; `direction` remains supported for compatibility.
Resizable.Panel.defaultSizeResponsiveValue<string>

Configures Resizable.Panel.defaultSize for this component.

Complete TypeScript API

Import from @tavojs/ui/resizable. Published exports: Resizable, ResizableHandle, ResizableHandleProps, ResizableOrientation, ResizablePanel, ResizablePanelProps, ResizableProps, ResizableRoot, clampResizableValue.

ResizableProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Resizable.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by Resizable.

idstring

No

Inherited id attribute accepted by Resizable.

rolestring

No

Inherited role attribute accepted by Resizable.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Resizable.

titlestring

No

Inherited title attribute accepted by Resizable.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Resizable.

hiddenboolean

No

Inherited hidden attribute accepted by Resizable.

disabledboolean

No

Inherited disabled attribute accepted by Resizable.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Resizable.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Resizable.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Resizable.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Resizable.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Resizable.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Resizable.

direction"horizontal" | "vertical"

No

Configures direction for this component.

orientationResizableOrientation

No

Separator orientation; `direction` remains supported for compatibility.

valuenumber

No

Inherited value attribute accepted by Resizable.

defaultValuenumber

No

Inherited defaultValue attribute accepted by Resizable.

minnumber

No

Inherited min attribute accepted by Resizable.

maxnumber

No

Inherited max attribute accepted by Resizable.

stepnumber

No

Inherited step attribute accepted by Resizable.

largeStepnumber

No

Inherited largeStep attribute accepted by Resizable.

onResizeStart(value: number) => void

No

Inherited onResizeStart attribute accepted by Resizable.

onValueInput(value: number) => void

No

Inherited onValueInput attribute accepted by Resizable.

onValueChange(value: number) => void

No

Inherited onValueChange attribute accepted by Resizable.

onResizeCancel(value: number) => void

No

Inherited onResizeCancel attribute accepted by Resizable.

ResizablePanelProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Resizable.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by Resizable.

idstring

No

Inherited id attribute accepted by Resizable.

rolestring

No

Inherited role attribute accepted by Resizable.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Resizable.

titlestring

No

Inherited title attribute accepted by Resizable.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Resizable.

hiddenboolean

No

Inherited hidden attribute accepted by Resizable.

disabledboolean

No

Inherited disabled attribute accepted by Resizable.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Resizable.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Resizable.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Resizable.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Resizable.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Resizable.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Resizable.

defaultSizeResponsiveValue<string>

No

Inherited defaultSize attribute accepted by Resizable.

ResizableHandleProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Resizable.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by Resizable.

idstring

No

Inherited id attribute accepted by Resizable.

rolestring

No

Inherited role attribute accepted by Resizable.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Resizable.

titlestring

No

Inherited title attribute accepted by Resizable.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Resizable.

hiddenboolean

No

Inherited hidden attribute accepted by Resizable.

disabledboolean

No

Inherited disabled attribute accepted by Resizable.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Resizable.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Resizable.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Resizable.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Resizable.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Resizable.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Resizable.

hitAreastring | number

No

Inherited hitArea attribute accepted by Resizable.

onPointerDownTavoEventHandler<PointerEvent>

No

Inherited onPointerDown attribute accepted by Resizable.

State ownership and DOM target

ConcernContract
StateUse value for controlled size or defaultValue for an initial size. onValueInput previews, onValueChange commits, and onResizeCancel restores a cancelled drag.
DOM targetPublic passthrough props target the component root. Treat nested elements and private class names as implementation details.

Anatomy and related components

Public compound members: Root, Panel, Handle

Limitations

Use SplitPane for a fixed two-region layout. Resizable changes its own root size; the surrounding layout and persistence remain application responsibilities.

Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.

Accessibility

Handles expose separator orientation and numeric ARIA values. Arrow keys resize by `step`; Shift+Arrow uses `largeStep`; Escape cancels pointer drags.

  • Handles expose separator orientation and numeric ARIA values. Arrow keys resize by `step`; Shift+Arrow uses `largeStep`; Escape cancels pointer drags.

Component status

ContractCurrent value
Maturitystable
Categorylayout
Component import@tavojs/ui/resizable
Explicit CSS import@tavojs/ui/css/resizable
PreviewInteractive preview available on this page