Skip to content

splitter

CyanideX edited this page Aug 5, 2026 · 2 revisions

Splitter

Draggable dividers for two-panel, multi-panel, and collapsible toggle layouts.

Quick Start

local wu = GetMod("WindowUtils")
local split = wu.Splitter

-- Simple horizontal split: left | right
split.horizontal("myPanels", function()
    ImGui.Text("Left side")
end, function()
    ImGui.Text("Right side")
end, { defaultPct = 0.3 })

-- Multi-panel layout with weighted sizes
split.multi("layout", {
    { width = 200, content = drawSidebar },
    { content = drawMain },
    { width = "25%", content = drawProps },
}, { direction = "horizontal" })

-- Collapsible toggle panel
split.toggle("toolbar", {
    { content = drawToolbar },
    { content = drawCanvas },
}, { side = "left", size = 200 })

Sub-File Index

File Contents
split Two-Panel Splits: horizontal, vertical, getSplitPct, setSplitPct, reset
multi Multi-Panel: multi, Panel Definition, Edge Toggles, resetMulti, getMultiBreakpoints
toggle Toggle Panels: toggle, all toggle opts, state functions, getMinSize, getExpandConstraint, getExpandSizePx, getSavedToggle, registerToggle, destroy

Options are mostly first-call-only. For horizontal, vertical, multi, and toggle, most opts fields are consumed when the state for an id is created and are then ignored on every later frame. A handful are re-read every frame. Each sub-file has an "Option Lifetime" section listing which is which; check it before trying to drive a splitter by changing its opts at runtime.

Aliases

Full Name Alias
splitter.horizontal(...) splitter.h(...)
splitter.vertical(...) splitter.v(...)
splitter.multi(...) splitter.m(...)
splitter.toggle(...) splitter.t(...)

Interaction

Grab Bar

The divider bar shows state through color and cursor:

  • Idle - transparent background, muted grey icon
  • Hover - subtle blue background, bright icon, resize cursor
  • Dragging - green background, white icon, resize cursor

Icon glyphs (requires IconGlyphs): vertical bars || for horizontal splits, horizontal bars == for vertical splits.

Double-Click Collapse

Double-clicking a two-panel grab bar collapses the panel:

  • If the split is <= 50%, collapses to minPct
  • If the split is > 50%, collapses to maxPct
  • Double-clicking again restores the previous position

Collapse uses a smoothstep animation.

Modifier Keys

Key Effect
Ctrl + drag Snap divider to 5% increments
Shift + drag Proportionally scale all neighboring panels (multi-splitter only)

Context Menu (Multi-Splitter)

Right-clicking a multi-splitter divider opens a context menu:

  • Reset Column/Row - reset this splitter's breakpoints to defaults
  • Reset All - reset all multi-splitters to defaults

Clone this wiki locally