Skip to content

Splitter

A resizable split-pane layout - drag the handle to resize, built on Reka UI's own resizable-panel primitive.

Usage

Panel one
Panel two
vue-html
<SSplitter>
  <SSplitterPanel :default-size="30" :min-size="20">Panel one</SSplitterPanel>
  <SSplitterResizeHandle />
  <SSplitterPanel :min-size="20">Panel two</SSplitterPanel>
</SSplitter>

Three components used together - SSplitter (the group), one SSplitterPanel per pane, and an SSplitterResizeHandle between each pair of panels you want draggable. Sizes are percentages of the group's total by default (sizeUnit="%" on SSplitterPanel); pass sizeUnit="px" for pixel-based panels instead. A pixel defaultSize also applies in the server-rendered layout, before the group measures its container. DashboardSidebar uses this to keep its default width at 260px while the main panel fills the remaining space.

SSplitterPanel has no visual styling of its own beyond clipping its own overflow - what a panel looks like depends entirely on what it's used for, left to the consumer.

Collapsible panels

A panel with collapsible snaps fully closed once dragged past its own minSize, down to collapsedSize (0 by default - fully hidden). Call .collapse()/.expand() on a template ref to do the same thing programmatically - see DashboardSidebar's own source for a real example, driven by a button elsewhere on the page rather than a drag gesture.

SSplitterPanel's own default slot is scoped with { isCollapsed, isExpanded, collapse, expand } - the same collapse()/expand() functions as the template-ref methods above, plus live isCollapsed/isExpanded booleans, so content inside the panel can react to (or trigger) collapse state without needing a ref at all:

vue-html
<SSplitterPanel collapsible :collapsed-size="0">
  <template #default="{ isCollapsed, expand }">
    <button v-if="isCollapsed" @click="expand()">Expand</button>
    <p v-else>Panel content</p>
  </template>
</SSplitterPanel>

Persistence

autoSaveId (on SSplitter) remembers every panel's size across reloads, via localStorage by default - pass a custom storage object (anything shaped { getItem, setItem }) to persist somewhere else instead, the same mechanism DashboardGroup uses to persist to a cookie. Whichever storage is used, the remembered layout only applies once mounted, not during SSR - Reka's own layout-restore call runs inside a watch() callback, which Vue's SSR render pass doesn't flush.

Custom :ui

Each of the three components keeps its own theme file. To see exactly what you'd be overriding - the current default classes for every slot - here they are:

Splitter

Theme source "splitter" not found

SplitterPanel

SplitterPanel has no visual styling of its own beyond clipping overflow (see Usage above), but the slot is still there to override if you need to add your own:

Theme source "splitter-panel" not found

SplitterResizeHandle

Theme source "splitter-resize-handle" not found

Props

Splitter

PropTypeDefault
direction'horizontal' | 'vertical''horizontal'
autoSaveIdstring-
keyboardResizeBynumber10
storage{ getItem, setItem }- (Reka's own localStorage-backed default)
uiPartial<Record<'root', string | object>>-

SplitterPanel

PropTypeDefault
defaultSizenumber-
minSizenumber-
maxSizenumber-
collapsedSizenumber-
collapsibleboolean-
sizeUnit'px' | '%''%'
ordernumber-
uiPartial<Record<'root', string | object>>-

SplitterResizeHandle

PropTypeDefault
direction'horizontal' | 'vertical''horizontal'
disabledboolean-
uiPartial<Record<SplitterResizeHandleSlot, string | object>>-

Emits

Splitter

EventPayload
layoutnumber[] - every panel's own current size

SplitterPanel

EventPayload
collapse-
expand-
resizenumber

Slots

SplitterPanel

SlotPropsDescription
default{ isCollapsed, isExpanded, collapse, expand }Panel content, scoped with live collapse state and the same collapse()/expand() functions as the template-ref methods below

Methods

SplitterPanel

Access these via a template ref on SSplitterPanel.

MethodDescription
collapse()Snaps the panel closed to collapsedSize
expand()Restores the panel to its size before it was last collapsed
resize(size: number)Sets the panel's size directly, in whatever unit sizeUnit is
getSize()Returns the panel's current size, in whatever unit sizeUnit is
isCollapsedWhether the panel is currently collapsed
isExpandedWhether the panel is currently expanded
Edit this page