Repository navigation
splitter
Draggable dividers for two-panel, multi-panel, and collapsible toggle layouts.
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 })| 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, andtoggle, mostoptsfields are consumed when the state for anidis 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.
| Full Name | Alias |
|---|---|
splitter.horizontal(...) |
splitter.h(...) |
splitter.vertical(...) |
splitter.v(...) |
splitter.multi(...) |
splitter.m(...) |
splitter.toggle(...) |
splitter.t(...) |
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-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.
| Key | Effect |
|---|---|
| Ctrl + drag | Snap divider to 5% increments |
| Shift + drag | Proportionally scale all neighboring panels (multi-splitter only) |
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