Skip to main content

Resizable

Arrange panels with draggable and keyboard-operated size boundaries.

Navigation Rail
Draggable boundary with min constraint.
min: 20%
Workspace Viewport
Expands or shrinks dynamically as adjacent handles move.
min: 30%
Props
Slots

Anatomy#

Resizable [component; slot=root]
├── Resizable.Panel [part; slot=panel]
├── Resizable.Handle [part; slot=handle]
│   ├── intersection [slot]
│   ├── grip [slot]
│   └── intersection [slot]
└── Resizable.Panel [part; slot=panel]

Usage#

Use Resizable to split space into draggable, keyboard-operated panels for multi-pane layouts. For a single expandable disclosure or a drawer, use Collapsible or Sheet.

The root owns the size of every panel as a layout record: a Record keyed by panel id, with sizes as percentages of the group (0–100). Resizable.Panel sets each panel’s min, max, and collapse constraints. Place Resizable.Handle between two panels to add pointer dragging, keyboard resizing, and collapse toggles. Set orientation="vertical" on the root to stack panels instead of placing them side by side.

import { Resizable } from 'moraine'

export function Example() {
  return (
    <div class="h-64 w-full border border-border/60 rounded-xl overflow-hidden bg-card/30">
      <Resizable defaultValue={{ sidebar: 30, content: 70 }}>
        <Resizable.Panel id="sidebar" min={20} class="p-4 bg-muted/20">
          Sidebar
        </Resizable.Panel>
        <Resizable.Handle />
        <Resizable.Panel id="content" min={30} class="p-4 bg-background/50">
          Content
        </Resizable.Panel>
      </Resizable>
    </div>
  )
}

Panel constraints#

Give the root defaultValue for initial sizes and set min or max on each panel. All values are percentages of the group. Dragging a handle grows one panel and shrinks its neighbor, stopping at each panel’s min (default 0) and max (default 100). A panel with resizable={false} stays at its current size, and the handles next to it are disabled. Panels without an entry in the layout record share the remaining space.

<Resizable defaultValue={{ inspector: 32, viewport: 68 }}>
  <Resizable.Panel id="inspector" min={25} max={45}>
    Inspector
  </Resizable.Panel>
  <Resizable.Handle />
  <Resizable.Panel id="viewport" min={35}>
    Viewport
  </Resizable.Panel>
</Resizable>

Collapsible panels#

Set collapsible on a panel to let it collapse to collapsedSize (default 0, clamped between 0 and min). Dragging a handle past the midpoint between min and collapsedSize collapses the panel, and pressing ↵ on a handle toggles its nearest collapsible neighbor: the preceding panel first, then the following one. A handle’s children can be a render function that receives collapsed, dragging, active, canCollapse, disabled, and orientation to switch the icon; pass false to hide the grip. onCollapse and onExpand fire on transitions, not for the initial layout.

Inside panel content, Resizable.usePanel() exposes collapse(), expand(), resize(size), size, and collapsed. Use it to build a collapse button. expand() restores the last expanded size, or min when there is none.

function CollapseButton() {
  const panel = Resizable.usePanel()
  return (
    <button onClick={() => (panel.collapsed() ? panel.expand() : panel.collapse())}>
      <Icon name={panel.collapsed() ? 'i-lucide:panel-left-open' : 'i-lucide:panel-left-close'} />
    </button>
  )
}

;<Resizable>
  <Resizable.Panel id="nav" collapsible collapsedSize={8} min={20}>
    <NavList />
    <CollapseButton />
  </Resizable.Panel>
  <Resizable.Handle>
    {(state) => (
      <Icon name={state.collapsed ? 'i-lucide:panel-left-open' : 'i-lucide:panel-left-close'} />
    )}
  </Resizable.Handle>
  <Resizable.Panel id="main">Content</Resizable.Panel>
</Resizable>

Controlled state and persistence#

Use value with onValueChange when the application coordinates layout presets, resets, or persists splits to storage. Both carry the full layout record keyed by panel id. With value set, resizing only calls onValueChange, and the panels follow the value you pass back. onValueChange fires on every layout change, including each step of a drag. onValueCommit fires once per completed interaction: a drag that changed the layout, each keyboard step that changed it, a collapse toggle, or a usePanel() call.

<Resizable value={layout()} onValueChange={setLayout} onValueCommit={persist}>
  <Resizable.Panel id="logs" min={15}>
    Logs
  </Resizable.Panel>
  <Resizable.Handle />
  <Resizable.Panel id="output" min={15}>
    Output
  </Resizable.Panel>
</Resizable>

Keyboard interaction#

Handles render focusable role="separator" elements. Their aria-valuenow, aria-valuemin, and aria-valuemax describe the preceding panel; aria-valuemin is collapsedSize for a collapsible panel. A disabled handle (the group is disabled, or a neighbor has resizable={false}) leaves the tab order. Horizontal groups in right-to-left content swap the arrow keys.

Key Description
← / ↑ Shrinks the preceding panel by step (default 10%).
→ / ↓ Grows the preceding panel by step (default 10%).
⇧ + Arrow Moves the handle as far as the panels’ min and max allow.
↖ Shrinks the preceding panel as far as the panels’ min and max allow.
↘ Grows the preceding panel as far as the panels’ min and max allow.
↵ Toggles the nearest collapsible panel (preceding, then following).
Alt + drag Distributes the movement symmetrically across the panels in groups of three or more.

Examples#

Constrain an inspector beside a token file#

Set min and max so the inspector cannot consume the editor.

import { Icon, Resizable } from 'moraine'

export function Constraints() {
  return (
    <div class="border border-border/60 rounded-xl bg-card/30 h-64 w-full shadow-xs overflow-hidden">
      <Resizable defaultValue={{ inspector: 32, viewport: 68 }}>
        <Resizable.Panel
          id="inspector"
          min={25}
          max={45}
          class="p-3 bg-muted/20 flex flex-col min-w-0 justify-between"
        >
          <div class="space-y-3">
            <div class="flex items-center justify-between">
              <span class="text-xs text-foreground font-semibold flex gap-1.5 items-center">
                <Icon name="i-lucide:sliders" class="text-muted-foreground size-3.5" />
                Inspector
              </span>
              <span class="text-[10px] text-muted-foreground font-mono px-1.5 py-0.5 rounded bg-muted">
                25% – 45%
              </span>
            </div>

            <div class="text-xs space-y-2">
              <div class="p-2 border border-border/40 rounded-lg bg-background/60 space-y-1">
                <div class="text-[11px] text-muted-foreground">Canvas Grid</div>
                <div class="text-xs text-foreground font-medium">8px Baseline (Fluid)</div>
              </div>
              <div class="p-2 border border-border/40 rounded-lg bg-background/60 space-y-1">
                <div class="text-[11px] text-muted-foreground">Color Profile</div>
                <div class="text-xs text-foreground font-medium">Display P3 (Wide Gamut)</div>
              </div>
            </div>
          </div>

          <div class="text-[11px] text-muted-foreground/80 flex gap-1 items-center">
            <Icon name="i-lucide:info" class="shrink-0 size-3" />
            <span class="truncate">Boundary stops dragging at limits.</span>
          </div>
        </Resizable.Panel>

        <Resizable.Handle />

        <Resizable.Panel
          id="viewport"
          min={35}
          class="p-4 bg-background/50 flex flex-col justify-between"
        >
          <div class="space-y-2">
            <div class="flex items-center justify-between">
              <span class="text-xs text-muted-foreground font-medium flex gap-1.5 items-center">
                <Icon name="i-lucide:file-text" class="size-3.5" />
                design-tokens.json
              </span>
              <span class="text-[10px] text-muted-foreground">Viewport: min 35%</span>
            </div>
            <div class="text-xs text-muted-foreground font-mono p-3 border border-border/50 rounded-lg bg-muted/10 space-y-1">
              <div>{'{'}</div>
              <div class="text-emerald-600 pl-4 dark:text-emerald-400">
                "spacing-unit": "0.25rem",
              </div>
              <div class="text-blue-600 pl-4 dark:text-blue-400">"radius-panel": "0.75rem",</div>
              <div class="text-purple-600 pl-4 dark:text-purple-400">"handle-hit-area": "6px"</div>
              <div>{'}'}</div>
            </div>
          </div>

          <div class="text-xs text-muted-foreground pt-2 border-t border-border/40 flex items-center justify-between">
            <span>Drag the separator to verify min and max limits.</span>
            <span class="text-[11px] font-mono">68% active</span>
          </div>
        </Resizable.Panel>
      </Resizable>
    </div>
  )
}

Collapse a project sidebar to an icon rail#

Use collapsedSize for the remaining rail width. ↵ on the handle or a Resizable.usePanel() button toggles it.

import { Button, Icon, Resizable } from 'moraine'
import type { ResizableT } from 'moraine'
import { For, createSignal, Show } from 'solid-js'

const NAV_ITEMS = [
  { icon: 'i-lucide:layout-dashboard', label: 'Dashboard', badge: '3' },
  { icon: 'i-lucide:folder-git-2', label: 'Repositories' },
  { icon: 'i-lucide:activity', label: 'Deployments', badge: 'Live' },
  { icon: 'i-lucide:settings', label: 'Settings' },
]

function CollapseButton() {
  const panel = Resizable.usePanel()

  return (
    <button
      type="button"
      class="text-muted-foreground rounded-md flex size-6 transition-colors items-center justify-center hover:text-foreground hover:bg-muted/60"
      onClick={() => (panel.collapsed() ? panel.expand() : panel.collapse())}
      aria-label={panel.collapsed() ? 'Expand sidebar' : 'Collapse sidebar'}
    >
      <Icon
        name={panel.collapsed() ? 'i-lucide:panel-left-open' : 'i-lucide:panel-left-close'}
        class="size-3.5"
      />
    </button>
  )
}

export function Collapsible() {
  const [collapsed, setCollapsed] = createSignal(false)
  const [layout, setLayout] = createSignal<ResizableT.Layout>({ nav: 30, main: 70 })

  return (
    <div class="space-y-3">
      <div class="text-xs flex items-center justify-between">
        <div class="flex gap-2 items-center">
          <Button
            variant="outline"
            size="xs"
            onClick={() =>
              setLayout((prev) => (collapsed() ? { ...prev, nav: 30 } : { ...prev, nav: 8 }))
            }
            leading={collapsed() ? 'i-lucide:panel-left-open' : 'i-lucide:panel-left-close'}
          >
            {collapsed() ? 'Expand sidebar' : 'Collapse sidebar'}
          </Button>
          <span class="text-muted-foreground">
            Collapse button, shortcut button, or <kbd>Enter</kbd> on the handle
          </span>
        </div>
        <span class="text-[11px] text-muted-foreground font-mono">
          {collapsed() ? 'Rail: collapsed' : `Panel: ${Math.round(layout().nav ?? 0)}%`}
        </span>
      </div>

      <div class="border border-border/60 rounded-xl bg-card/30 h-64 w-full shadow-xs overflow-hidden">
        <Resizable value={layout()} onValueChange={setLayout}>
          <Resizable.Panel
            id="nav"
            min={20}
            max={40}
            collapsible
            collapsedSize={8}
            onCollapse={() => setCollapsed(true)}
            onExpand={() => setCollapsed(false)}
            class="bg-muted/25 flex flex-col transition-colors justify-between"
          >
            <div class="p-2 space-y-1">
              <For each={NAV_ITEMS}>
                {(item) => (
                  <div
                    class={`text-xs px-2.5 py-1.5 rounded-lg flex gap-2.5 cursor-pointer transition-colors items-center ${
                      item.label === 'Dashboard'
                        ? 'bg-accent text-accent-foreground font-medium'
                        : 'text-muted-foreground hover:bg-muted/60 hover:text-foreground'
                    }`}
                  >
                    <Icon name={item.icon} class="shrink-0 size-4" />
                    <span class="flex-1 truncate">{item.label}</span>
                    <Show when={item.badge}>
                      <span class="text-[10px] text-muted-foreground font-mono px-1 rounded bg-muted">
                        {item.badge}
                      </span>
                    </Show>
                  </div>
                )}
              </For>
            </div>

            <div class="p-2.5 border-t border-border/40 flex gap-2 items-center">
              <CollapseButton />
              <div class="text-[10px] text-primary font-semibold rounded-full bg-primary/20 flex size-6 items-center justify-center">
                MO
              </div>
              <div class="text-[11px] text-muted-foreground truncate">moraine-app</div>
            </div>
          </Resizable.Panel>

          <Resizable.Handle>
            {(state) => (
              <Icon
                name={state.collapsed ? 'i-lucide:panel-left-open' : 'i-lucide:panel-left-close'}
                class="text-muted-foreground/80 size-3"
              />
            )}
          </Resizable.Handle>

          <Resizable.Panel id="main" class="p-4 bg-background/50 flex flex-col justify-between">
            <div class="space-y-3">
              <div class="pb-2 border-b border-border/40 flex items-center justify-between">
                <span class="text-xs text-foreground font-semibold">Project Overview</span>
                <span class="text-[10px] text-muted-foreground">Updated 2m ago</span>
              </div>
              <div class="text-xs gap-2 grid grid-cols-2">
                <div class="p-3 border border-border/50 rounded-lg bg-muted/15 space-y-1">
                  <div class="text-[11px] text-muted-foreground">Build Status</div>
                  <div class="text-emerald-600 font-medium flex gap-1.5 items-center dark:text-emerald-400">
                    <span class="rounded-full bg-emerald-500 size-1.5 animate-pulse" />
                    Operational
                  </div>
                </div>
                <div class="p-3 border border-border/50 rounded-lg bg-muted/15 space-y-1">
                  <div class="text-[11px] text-muted-foreground">Hydration Score</div>
                  <div class="text-foreground font-medium">99.8%</div>
                </div>
              </div>
            </div>

            <p class="text-[11px] text-muted-foreground">
              When collapsed, the panel retains a slim icon rail without unmounting state.
            </p>
          </Resizable.Panel>
        </Resizable>
      </div>
    </div>
  )
}

Switch between saved split presets#

Own value when the page stores layout records or offers presets.

import { Button, Resizable } from 'moraine'
import type { ResizableT } from 'moraine'
import { createSignal } from 'solid-js'

export function Controlled() {
  const [layout, setLayout] = createSignal<ResizableT.Layout>({ logs: 35, telemetry: 65 })

  return (
    <div class="space-y-3">
      <div class="flex flex-wrap gap-2 items-center justify-between">
        <div class="flex gap-1.5 items-center">
          <Button
            variant="outline"
            size="xs"
            onClick={() => setLayout({ logs: 25, telemetry: 75 })}
          >
            25 / 75
          </Button>
          <Button
            variant="outline"
            size="xs"
            onClick={() => setLayout({ logs: 50, telemetry: 50 })}
          >
            50 / 50
          </Button>
          <Button
            variant="outline"
            size="xs"
            onClick={() => setLayout({ logs: 75, telemetry: 25 })}
          >
            75 / 25
          </Button>
        </div>
        <div class="text-xs text-muted-foreground font-mono">
          Left: {Math.round(layout().logs ?? 0)}% | Right: {Math.round(layout().telemetry ?? 0)}%
        </div>
      </div>

      <div class="border border-border/60 rounded-xl bg-card/30 h-60 w-full shadow-xs overflow-hidden">
        <Resizable value={layout()} onValueChange={setLayout}>
          <Resizable.Panel id="logs" min={15} class="p-4 bg-muted/20 flex flex-col justify-between">
            <div class="space-y-2">
              <span class="text-xs text-foreground font-semibold">Worker Logs</span>
              <p class="text-[11px] text-muted-foreground leading-relaxed">
                Controlled through an external Solid signal. The layout record is keyed by panel id,
                so panels can be added or removed without losing their entries.
              </p>
            </div>
            <span class="text-[10px] text-muted-foreground font-mono">min: 15%</span>
          </Resizable.Panel>

          <Resizable.Handle />

          <Resizable.Panel
            id="telemetry"
            min={15}
            class="p-4 bg-background/50 flex flex-col justify-between"
          >
            <div class="space-y-2">
              <span class="text-xs text-foreground font-semibold">Telemetry Output</span>
              <p class="text-[11px] text-muted-foreground leading-relaxed">
                Use controlled state when persisting split configuration to localStorage or URL
                parameters.
              </p>
            </div>
            <span class="text-[10px] text-muted-foreground font-mono">min: 15%</span>
          </Resizable.Panel>
        </Resizable>
      </div>
    </div>
  )
}

Nested IDE workspace#

Combine a horizontal root and a vertical root for an explorer, editor, and console. Set intersection on the handles that meet so their junction drags on both axes at once.

import { Icon, Resizable } from 'moraine'
import { For } from 'solid-js'

const FILES = [
  { name: 'src/app.tsx', active: true, icon: 'i-lucide:file-code', color: 'text-blue-500' },
  { name: 'src/theme.ts', icon: 'i-lucide:file-code', color: 'text-blue-500' },
  { name: 'package.json', icon: 'i-lucide:file-json', color: 'text-amber-500' },
  { name: 'README.md', icon: 'i-lucide:file-text', color: 'text-muted-foreground' },
]

export function NestedPanels() {
  return (
    <div class="border border-border rounded-xl bg-card/30 h-80 w-full shadow-xs overflow-hidden">
      <Resizable defaultValue={{ sidebar: 28, workspace: 72 }}>
        {/* Sidebar explorer */}
        <Resizable.Panel
          id="sidebar"
          min={20}
          max={40}
          class="bg-muted/25 flex flex-col justify-between"
        >
          <div>
            <div class="text-[11px] text-muted-foreground tracking-wider font-semibold px-3 border-b border-border/50 flex h-8 uppercase items-center justify-between">
              <span>Explorer</span>
              <Icon name="i-lucide:more-horizontal" class="size-3.5" />
            </div>
            <div class="p-1 space-y-0.5">
              <For each={FILES}>
                {(file) => (
                  <div
                    class={`text-xs px-2 py-1 rounded-md flex gap-2 cursor-pointer transition-colors items-center ${
                      file.active
                        ? 'bg-accent text-accent-foreground font-medium'
                        : 'text-muted-foreground hover:bg-muted/50 hover:text-foreground'
                    }`}
                  >
                    <Icon name={file.icon} class={`shrink-0 size-3.5 ${file.color}`} />
                    <span class="truncate">{file.name}</span>
                  </div>
                )}
              </For>
            </div>
          </div>
          <div class="text-[10px] text-muted-foreground px-3 py-1.5 border-t border-border/40 flex items-center justify-between">
            <span>branch: main</span>
            <span class="text-emerald-500">● clean</span>
          </div>
        </Resizable.Panel>

        {/* Intersection handle between sidebar and nested editor/terminal */}
        <Resizable.Handle intersection />

        {/* Nested vertical workspace */}
        <Resizable.Panel id="workspace" min={40}>
          <Resizable orientation="vertical" defaultValue={{ editor: 62, terminal: 38 }}>
            {/* Editor buffer */}
            <Resizable.Panel id="editor" min={30} class="bg-background flex flex-col">
              <div class="text-xs px-3 border-b border-border/50 bg-muted/30 flex gap-2 h-8 items-center">
                <Icon name="i-lucide:file-code" class="text-blue-500 size-3.5" />
                <span class="text-foreground font-medium">app.tsx</span>
                <span class="rounded-full bg-blue-500 size-1.5" />
              </div>
              <div class="text-xs text-muted-foreground font-mono p-3 bg-background/50 flex-1 overflow-auto space-y-1">
                <div class="text-muted-foreground/60">// Resizable Workspace Composition</div>
                <div>
                  <span class="text-purple-500">export function</span>{' '}
                  <span class="text-blue-500">Workspace</span>() {'{'}
                </div>
                <div class="pl-4">
                  <span class="text-purple-500">return</span> (
                </div>
                <div class="text-emerald-600 pl-8 dark:text-emerald-400">
                  {'<Resizable orientation="horizontal">'}
                </div>
                <div class="text-muted-foreground pl-12">{'<Resizable.Panel min={20} />'}</div>
                <div class="text-muted-foreground pl-12">{'<Resizable.Handle intersection />'}</div>
                <div class="text-emerald-600 pl-8 dark:text-emerald-400">{'</Resizable>'}</div>
                <div class="pl-4">)</div>
                <div>{'}'}</div>
              </div>
            </Resizable.Panel>

            {/* Intersection handle with grip icon */}
            <Resizable.Handle intersection>
              <Icon name="i-lucide:grip-horizontal" class="text-muted-foreground/80 size-3" />
            </Resizable.Handle>

            {/* Terminal console */}
            <Resizable.Panel
              id="terminal"
              min={20}
              class="bg-muted/20 flex flex-col justify-between"
            >
              <div class="text-[11px] text-muted-foreground px-3 border-b border-border/40 flex gap-3 h-7 items-center">
                <span class="text-foreground font-medium pt-0.5 border-primary border-b-2">
                  Terminal
                </span>
                <span>Output</span>
                <span>Problems (0)</span>
              </div>
              <div class="text-xs text-foreground font-mono p-2.5 space-y-0.5">
                <div class="text-muted-foreground">$ vite --host</div>
                <div class="text-emerald-600 dark:text-emerald-400">
                  ➜ Local: http://localhost:5173/
                </div>
              </div>
              <div class="text-[10px] text-muted-foreground px-2.5 py-1 border-t border-border/30 bg-muted/40 flex items-center justify-between">
                <span>Drag the junction corner to resize both axes simultaneously.</span>
                <span>node v22.14.0</span>
              </div>
            </Resizable.Panel>
          </Resizable>
        </Resizable.Panel>
      </Resizable>
    </div>
  )
}

Multi-column email client#

Compose a folder list, thread list, and reading pane. Min-width constraints keep each column readable.

import { Button, Icon, Resizable } from 'moraine'
import { For, createSignal, Show } from 'solid-js'

const FOLDERS = [
  { icon: 'i-lucide:inbox', label: 'Inbox', count: '12', active: true },
  { icon: 'i-lucide:send', label: 'Sent' },
  { icon: 'i-lucide:star', label: 'Starred', count: '4' },
  { icon: 'i-lucide:archive', label: 'Archive' },
  { icon: 'i-lucide:trash-2', label: 'Trash' },
]

const MESSAGES = [
  {
    id: 1,
    sender: 'Sarah Lin',
    subject: 'Moraine 0.5.0 Release Candidate',
    snippet: 'Hey team, the draft release notes and bundle size audit are ready…',
    time: '10:42 AM',
    unread: true,
  },
  {
    id: 2,
    sender: 'GitHub',
    subject: 'Pull request #142 merged',
    snippet: 'chore(resizable): refresh documentation and interactive previews…',
    time: 'Yesterday',
    unread: false,
  },
  {
    id: 3,
    sender: 'Vercel Bot',
    subject: 'Deployment preview succeeded',
    snippet: 'Your preview deployment for branch docs-resizable is live…',
    time: '2d ago',
    unread: false,
  },
]

export function Composition() {
  const [activeMessageId, setActiveMessageId] = createSignal(1)
  const activeMessage = () => MESSAGES.find((m) => m.id === activeMessageId())!

  return (
    <div class="border border-border/60 rounded-xl bg-card/30 h-80 w-full shadow-xs overflow-hidden">
      <Resizable defaultValue={{ folders: 22, messages: 36, reading: 42 }}>
        {/* Column 1: Mailboxes */}
        <Resizable.Panel
          id="folders"
          min={16}
          max={30}
          class="p-2 bg-muted/25 flex flex-col justify-between"
        >
          <div class="space-y-1">
            <div class="text-xs text-foreground font-semibold px-2 py-1 flex gap-1.5 items-center">
              <Icon name="i-lucide:mail" class="text-primary size-3.5" />
              Mailboxes
            </div>
            <For each={FOLDERS}>
              {(folder) => (
                <div
                  class={`text-xs px-2 py-1.5 rounded-lg flex cursor-pointer transition-colors items-center justify-between ${
                    folder.active
                      ? 'bg-accent text-accent-foreground font-medium'
                      : 'text-muted-foreground hover:bg-muted/50 hover:text-foreground'
                  }`}
                >
                  <div class="flex gap-2 truncate items-center">
                    <Icon name={folder.icon} class="shrink-0 size-3.5" />
                    <span class="truncate">{folder.label}</span>
                  </div>
                  <Show when={folder.count}>
                    <span class="text-[10px] text-muted-foreground font-mono px-1 rounded bg-muted">
                      {folder.count}
                    </span>
                  </Show>
                </div>
              )}
            </For>
          </div>
          <div class="text-[10px] text-muted-foreground p-2 border-t border-border/40">
            3 panes coordinated
          </div>
        </Resizable.Panel>

        <Resizable.Handle />

        {/* Column 2: Message list */}
        <Resizable.Panel id="messages" min={26} max={50} class="bg-background/60 flex flex-col">
          <div class="p-2 border-b border-border/50 flex gap-2 items-center">
            <Icon name="i-lucide:search" class="text-muted-foreground size-3.5" />
            <input
              type="text"
              placeholder="Search messages…"
              class="text-xs outline-none bg-transparent w-full placeholder:text-muted-foreground/60"
            />
          </div>
          <div class="flex-1 overflow-auto divide-border/40 divide-y">
            <For each={MESSAGES}>
              {(msg) => (
                <div
                  onClick={() => setActiveMessageId(msg.id)}
                  class={`text-xs p-3 cursor-pointer transition-colors space-y-1 ${
                    activeMessageId() === msg.id
                      ? 'bg-muted/50'
                      : 'hover:bg-muted/20 text-muted-foreground'
                  }`}
                >
                  <div class="flex items-center justify-between">
                    <span
                      class={`font-medium truncate ${msg.unread ? 'text-primary' : 'text-foreground'}`}
                    >
                      {msg.sender}
                    </span>
                    <span class="text-[10px] text-muted-foreground shrink-0">{msg.time}</span>
                  </div>
                  <div class="text-foreground font-medium truncate">{msg.subject}</div>
                  <p class="text-[11px] text-muted-foreground line-clamp-1">{msg.snippet}</p>
                </div>
              )}
            </For>
          </div>
        </Resizable.Panel>

        <Resizable.Handle />

        {/* Column 3: Reading pane */}
        <Resizable.Panel
          id="reading"
          min={30}
          class="p-4 bg-background flex flex-col justify-between"
        >
          <div class="space-y-4">
            <div class="pb-3 border-b border-border/40 flex items-start justify-between">
              <div>
                <div class="text-sm text-foreground font-semibold">{activeMessage().subject}</div>
                <div class="text-xs text-muted-foreground mt-0.5">
                  From: <span class="text-foreground">{activeMessage().sender}</span>
                </div>
              </div>
              <div class="flex gap-1 items-center">
                <Button variant="ghost" size="icon-xs" aria-label="Reply">
                  <Icon name="i-lucide:reply" class="size-3.5" />
                </Button>
                <Button variant="ghost" size="icon-xs" aria-label="Archive">
                  <Icon name="i-lucide:archive" class="size-3.5" />
                </Button>
              </div>
            </div>

            <p class="text-xs text-muted-foreground leading-relaxed">
              {activeMessage().snippet} All test suites and hydration verification checks passed
              with zero warnings across both UnoCSS and Tailwind preset configurations.
            </p>
          </div>

          <div class="text-[11px] text-muted-foreground pt-2 border-t border-border/40 flex items-center justify-between">
            <span>Multi-pane responsive split view</span>
            <span class="text-[10px] font-mono">moraine.v0.5</span>
          </div>
        </Resizable.Panel>
      </Resizable>
    </div>
  )
}

Vertical query workbench#

Use orientation="vertical" for a query editor over a result table. disabled locks dividers during execution.

import { Button, Icon, Resizable } from 'moraine'
import { For, createSignal } from 'solid-js'

const DATA_ROWS = [
  { id: 'usr_01', name: 'Alice Chen', role: 'Maintainer', queries: '1,420', latency: '12ms' },
  { id: 'usr_02', name: 'Devin Cole', role: 'Contributor', queries: '834', latency: '18ms' },
  { id: 'usr_03', name: 'Kiran Patel', role: 'Viewer', queries: '129', latency: '9ms' },
]

export function VerticalDisable() {
  const [disabled, setDisabled] = createSignal(false)

  return (
    <div class="space-y-3">
      <div class="text-xs flex items-center justify-between">
        <div class="flex gap-2 items-center">
          <Button
            variant="outline"
            size="xs"
            onClick={() => setDisabled((prev) => !prev)}
            leading={disabled() ? 'i-lucide:lock' : 'i-lucide:unlock'}
          >
            {disabled() ? 'Unlock divider' : 'Lock divider'}
          </Button>
          <span class="text-muted-foreground">
            {disabled() ? 'Dividers locked against dragging' : 'Drag divider vertically to resize'}
          </span>
        </div>
        <span class="text-[11px] text-muted-foreground font-mono">orientation="vertical"</span>
      </div>

      <div class="border border-border/60 rounded-xl bg-card/30 h-80 w-full shadow-xs overflow-hidden">
        <Resizable
          orientation="vertical"
          disabled={disabled()}
          defaultValue={{ editor: 52, results: 48 }}
          classes={{ handle: 'bg-border/80' }}
        >
          {/* Top Panel: SQL Query Editor */}
          <Resizable.Panel
            id="editor"
            min={25}
            class="p-3 bg-muted/20 flex flex-col justify-between"
          >
            <div class="space-y-2">
              <div class="flex items-center justify-between">
                <span class="text-xs text-foreground font-semibold flex gap-1.5 items-center">
                  <Icon name="i-lucide:database" class="text-primary size-3.5" />
                  SQL Query Editor
                </span>
                <span class="text-[10px] text-muted-foreground font-mono">analytics_db.prod</span>
              </div>
              <div class="text-xs text-foreground font-mono p-2.5 border border-border/50 rounded-lg bg-background/70 space-y-1">
                <div>
                  <span class="text-purple-500">SELECT</span> id, name, role, queries, latency
                </div>
                <div>
                  <span class="text-purple-500">FROM</span> team_members
                </div>
                <div>
                  <span class="text-purple-500">WHERE</span> status ={' '}
                  <span class="text-emerald-600 dark:text-emerald-400">'active'</span>
                </div>
                <div>
                  <span class="text-purple-500">ORDER BY</span> queries{' '}
                  <span class="text-purple-500">DESC</span>;
                </div>
              </div>
            </div>

            <div class="pt-2 flex items-center justify-between">
              <span class="text-[11px] text-muted-foreground">Estimated scan: 3 rows (0.4ms)</span>
              <Button size="xs" leading="i-lucide:play">
                Execute
              </Button>
            </div>
          </Resizable.Panel>

          <Resizable.Handle>
            <Icon name="i-lucide:grip-horizontal" class="text-muted-foreground/70 size-3" />
          </Resizable.Handle>

          {/* Bottom Panel: Data Table Results */}
          <Resizable.Panel
            id="results"
            min={25}
            class="p-3 bg-background/50 flex flex-col justify-between"
          >
            <div class="overflow-auto space-y-2">
              <div class="text-xs flex items-center justify-between">
                <span class="text-foreground font-medium">Results</span>
                <span class="text-[10px] text-muted-foreground font-mono">3 rows returned</span>
              </div>
              <table class="text-xs text-left w-full">
                <thead>
                  <tr class="text-[11px] text-muted-foreground font-mono border-b border-border/50">
                    <th class="py-1">ID</th>
                    <th class="py-1">NAME</th>
                    <th class="py-1">ROLE</th>
                    <th class="py-1 text-right">LATENCY</th>
                  </tr>
                </thead>
                <tbody class="divide-border/30 divide-y">
                  <For each={DATA_ROWS}>
                    {(row) => (
                      <tr class="hover:bg-muted/30">
                        <td class="text-muted-foreground font-mono py-1">{row.id}</td>
                        <td class="text-foreground font-medium py-1">{row.name}</td>
                        <td class="text-muted-foreground py-1">{row.role}</td>
                        <td class="text-emerald-600 font-mono py-1 text-right dark:text-emerald-400">
                          {row.latency}
                        </td>
                      </tr>
                    )}
                  </For>
                </tbody>
              </table>
            </div>

            <div class="text-[11px] text-muted-foreground pt-1 border-t border-border/40">
              Vertical stack demonstrates flex-column layout with independent scrolling.
            </div>
          </Resizable.Panel>
        </Resizable>
      </div>
    </div>
  )
}

API Reference#

Attributes#

Attributes
data-splitter-root
Slot: resizable
Description: Identifies the root container of a splitter layout.
data-collapsed
Slot: resizable-panel
Description: Present when the panel or section is collapsed.
data-expanded
Slot: resizable-panel
Description: Present when the panel, accordion, or menu is expanded.
data-resizing
Slot: resizable-panel
Description: Present while resizable handles are actively dragging.
data-transitioning
Slot: resizable-panel
Description: Present while a resizable panel is transitioning between sizes.
data-active
Slot: resizable-handle
Description: Present when the item or trigger is active.
data-cross
Slot: resizable-handle
Description: Present while a resizable handle cross-target is active.
data-dragging
Slot: resizable-handle
Description: Present while the related thumb or handle is being dragged.
data-splitter-end-target
Slot: resizable-intersection
Description: Identifies the end intersection target for a splitter handle.
data-splitter-start-target
Slot: resizable-intersection
Description: Identifies the start intersection target for a splitter handle.

Props#

Resizable#

Renders a <div> element by default.

Prop

Panel#

Renders a <div> element by default.

Prop

Handle#

Renders a <div> element by default.

Prop