Split
Basic
The Split component allows you to create resizable panels with support for horizontal or vertical layouts. Each panel can have customizable sizes, minimum and maximum constraints, and unique styles.
The basic usage of the Split component involves defining a set of panels with customizable properties and specifying the layout direction (horizontal or vertical).
Panel Configuration
The panels prop allows you to define the layout and behavior of the panels within the Split component. Each panel is represented as an object with several properties, providing flexibility to customize size, constraints, and appearance. Below is a detailed explanation of each property, along with examples.
Name
The name property is a unique identifier for the panel. It is required and used to reference the panel in events, resizing operations, and slot definitions.
In this example:
- The first panel is identified by
name: "panel1". - The second panel is identified by
name: "panel2".
The name property is also used to bind specific slots for content.
Size
The size property specifies the initial size of the panel. The value can be defined in percentages or pixels, depending on the units prop of the Split component.
size values across all panels equals 100% (when using percentages) or matches the total available width or height (when using pixels). To avoid potential layout issues, it is recommended to leave one panel without a size value. Panels without a size will automatically adjust to fill the remaining space.Example Explanation:
- The
leftpanel is explicitly set to take 70% of the available space. - The
rightpanel automatically adjusts to take the remaining 30% of the space, ensuring the layout remains balanced.
When using pixels for the units prop, the same principle applies. Ensure the sum of size values does not exceed the container's total width or height, and prefer leaving one panel without a size value to let it adjust dynamically.
minSize
The minSize property defines the minimum size that the panel can shrink to during resizing. It is particularly useful for ensuring that a panel does not collapse or become unusable.
minSize value is greater than the size value, the panel will start with the minSize as its initial size. This ensures the panel respects its minimum constraints.Example Explanation:
- The
toppanel has asizeof 100 pixels but aminSizeof 150 pixels. As a result, it starts with 150 pixels to respect the minimum size constraint. - The
bottompanel has nominSizespecified and can shrink to 0 if necessary.
By properly configuring minSize, you can ensure that panels maintain usability while allowing flexible resizing.
maxSize
The maxSize property sets the maximum size that the panel can expand to during resizing. It ensures that the panel does not grow beyond the specified limit.
- If the sum of
sizevalues ormaxSizevalues across all panels exceeds 100% (for percentages) or the total available width or height (for pixels), layout issues may occur. - Ensure that
minSizeis not greater thanmaxSize. If this happens, themaxSizewill automatically be set to the value ofminSize. This avoids conflicting constraints. - Panel size behavior follows this priority:
minSize>maxSize>size. This means:minSizealways takes precedence.- If
maxSizeandsizeconflict,maxSizewill overridesize.
Example Explanation:
- The
leftpanel starts with 50% width but cannot grow beyond 60%. - The
rightpanel has aminSizeof 40% and amaxSizeof 50%. SinceminSizeis greater thanmaxSize,maxSizeis adjusted to matchminSize(40%). The panel starts at 40% and cannot grow or shrink.
By properly configuring maxSize, you can enforce size constraints while maintaining flexibility. Always ensure that minSize, maxSize, and size are consistent to avoid unexpected behavior.
Disabled
The disabled property disables resizing for the panel. When set to true, the panel cannot be resized, and the separator adjacent to it is inactive.
In this example:
- The
staticpanel is locked at 30% of the container's width and cannot be resized. - The
resizablepanel can be resized freely within its constraints.
Class
The class property allows you to apply a custom CSS class to the panel. This can be useful for applying styles such as background color, padding, or borders.
In this example:
- The
styledpanel has a custom background color, padding, and border defined in thecustom-panel-class. - The
defaultpanel uses the default styles.
Custom properties
You can pass additional custom properties for the panel, which can be used to extend functionality or transfer metadata to the panel.
Direction
The direction prop controls the layout direction of the panels. It can be one of the following values:
"horizontal": Panels are arranged side-by-side."vertical": Panels are stacked on top of each other.
Units
The units prop specifies the measurement units for panel sizes. It can be one of the following values:
"percentages": Sizes are defined as percentages of the container (default)."pixels": Sizes are defined in pixels.
Separator Opacity
The separatorNotHoverOpacity prop determines whether the separator's opacity reduces when not hovered. It accepts:
true: Separator is less visible when not hovered.false: Separator maintains full opacity (default).
Separator Type
The separatorType prop defines the appearance of the separator between panels. It can be one of the following values:
"strip": A simple strip separator (default)."hexagon": A hexagonal separator.- Any other valid icon name from your icon library.
Events
Resize Events
The Split component emits several events related to panel resizing:
updated-panels: Emitted when panel sizes are updated. Provides an object with the updated sizes.updated-size-panel: Emitted when a single panel's size is updated. Provides the new size and panel name.start-resize-panel: Emitted when resizing starts for a panel.stop-resize-panel: Emitted when resizing stops for a panel.move-resize-panel: Emitted when a panel is actively being resized.out-resize-panel: Emitted when the resize action exits a panel boundary.
This example demonstrates how to listen for resize-related events in the Split component.
Slots
Panel Slots
Each panel in the Split component can have a named slot corresponding to its name property. Use the slot to provide custom content for the panel.

