<cs-split-panel>
StableLayoutSince 0.1

Split panels display two adjacent panels separated by a draggable divider, letting users resize each side to suit their workflow.

Start
End

Examples

Initial Position

Set the position attribute to change the divider’s starting position, given as a percentage of the available space (50 by default). To set it in pixels instead, use the position-in-pixels attribute.

Start
End
Start
End

Orientation

Set the orientation attribute to vertical and provide a height to render the split panel in a vertical orientation where the start and end panels are stacked.

Start
End

Snapping

To snap panels at specific positions while dragging, add the snap attribute with one or more space-separated values. Values must be in pixels or percentages. For example, to snap the panel at 100px and 50%, use snap="100px 50%". You can also customize how close the divider must be before snapping with the snap-threshold attribute.

Start
End

Disabled

Add the disabled attribute to prevent the divider from being repositioned.

Start
End

Primary Panel

By default, both panels will grow or shrink proportionally when the host element is resized. If a primary panel is designated, it will maintain its size and the secondary panel will grow or shrink to fit the remaining space. You can set the primary panel to start or end using the primary attribute.

Try resizing the example below with each option and notice how the panels respond.

Start
End
None Start End

Min & Max

To set a minimum or maximum size of the primary panel, use the --min and --max custom properties. Since the secondary panel is flexible, size constraints can only be applied to the primary panel. If no primary panel is designated, these constraints will be applied to the start panel.

This examples demonstrates how you can ensure both panels are at least 150px using --min, --max, and the calc() function.

Start
End

Nested Split Panels

Create complex layouts that can be repositioned independently by nesting split panels.

Start
Top
Bottom

Customizing the Divider

You can target the divider part to apply CSS properties to the divider. To add a custom handle, slot an icon into the divider slot. When customizing the divider, make sure to think about focus styles for keyboard users.

Start
End

Here’s a more elaborate example that changes the divider’s color and width and adds a styled handle.

Start
End

API

Importing

If you're using the autoloader or a hosted project, components load on demand — no manual import needed. To cherry-pick this component, use one of the following snippets.

npm Self-Hosted React
import '@cruglobal/cornerstone-components/components/split-panel/split-panel.js';
import './cornerstone/components/split-panel/split-panel.js';
import CsSplitPanel from '@cruglobal/cornerstone-components/react/split-panel/index.js';

Slots

Learn more about using slots.

NameDescription
dividerThe divider. Useful for slotting in a custom icon that renders as a handle.
endContent to place in the end panel.
startContent to place in the start panel.

Attributes & Properties

Learn more about attributes and properties.

PropertyAttributeDescriptionTypeDefaultReflects
disableddisabledDisables resizing. Note that the position may still change as a result of resizing the host element.booleanfalseYes
orientationorientationSets the split panel's orientation.'horizontal' | 'vertical''horizontal'Yes
positionpositionThe current position of the divider from the primary panel's edge as a percentage 0-100. Defaults to 50% of the container's initial size.number50Yes
positionInPixelsposition-in-pixelsThe current position of the divider from the primary panel's edge in pixels.number
primaryprimaryIf no primary panel is designated, both panels will resize proportionally when the host element is resized. If a primary panel is designated, it will maintain its size and the other panel will grow or shrink as needed when the host element is resized.'start' | 'end' | undefined
snapsnapOne or more space-separated values at which the divider should snap. Values can be in pixels or percentages, e.g. "100px 50%".string | undefined
snapThresholdsnap-thresholdHow close the divider must be to a snap point until snapping occurs.number12

Events

Learn more about events.

NameDescription
cs-repositionEmitted when the divider's position changes.

CSS Custom Properties

Learn more about CSS custom properties.

NameDescriptionDefault
--divider-hit-areaThe invisible region around the divider where dragging can occur. This is usually wider than the divider to facilitate easier dragging.12px
--divider-widthThe width of the visible divider.4px
--maxThe maximum allowed size of the primary panel.100%
--minThe minimum allowed size of the primary panel.0

CSS Parts

Learn more about CSS parts.

NameDescriptionCSS selector
dividerThe divider that separates the start and end panels.::part(divider)
endThe end panel.::part(end)
panelTargets both the start and end panels.::part(panel)
startThe start panel.::part(start)