Read page as text

NIB / DOCUMENTATION

Resizable panels — NibComponents

Drag or nudge a real divider while respecting panel fractions and narrow-layout fallback.

Open interactive view

Move the boundary, not the content

Drag the divider to change the pair of panel fractions. Focus the handle and use the axis-appropriate arrow keys for small nudges; Home and End request the available extremes. Double-tap the handle or press Reset split to restore the original proportions.

onLayoutChanged reports a committed drag or keyboard interaction. The live percentage readout also listens to NibResizablePanelsController so it updates during a drag. No file or user preference is saved by this example.

Use fractions and validate external layouts

NibResizablePanel.minSize, maxSize, and initialSize are fractions between 0 and 1. This demo gives each panel a 20% minimum and 80% maximum. The controller starts from the configured first-panel share and its complement.

setSizes normalizes the supplied values but does not re-clamp them to every panel’s min/max. External callers must supply a sane layout. applyDelta applies the pair’s constraints; resetPanelPair and resetAll restore captured initial proportions. Dispose the controller in its owner.

Understand the exported handle

NibResizablePanelsHandle is publicly exported even though a stale source comment describes it as internal. The group normally creates it for you. Its direction, groupMainExtent, handleThickness, and sizeFraction describe geometry; onDeltaFraction, onDragEnd, and onReset connect interaction to your model.

kNibResizablePanelsKeyboardStep is the exported 0.02 fraction used by arrow nudges. The visual divider can be thinner than its interactive slot. animated controls its feedback, not whether resizing works. You do not need to construct a handle manually for an ordinary split layout.

Allow the narrow fallback to change the layout

When the main-axis extent is below panel count multiplied by kNibResizablePanelsNarrowFallbackPanelExtent, the package renders a vertical scrolling stack without handles. A narrow horizontal preview will therefore look different from the wide split.

Give fallback content useful intrinsic heights and give the group bounded width and height. This example uses 150-pixel content surfaces, so a fallback panel remains readable. A missing divider at narrow width is this documented fallback, not a disabled resize callback.