Back to Element Plus

Splitter

docs/en-US/component/splitter.md

2.13.74.2 KB
Original Source

Splitter ^(beta)

Divide the area horizontally or vertically, and freely drag to adjust the size of each area.

Basic usage

The most basic usage, if no default size is passed, it will be automatically divided equally.

:::demo

splitter/basic

:::

Vertical

Use vertical orientation.

:::demo

splitter/vertical

:::

Collapsible

Configuring collapsible provides quick shrinking capability. You can use the min property to prevent expanding through dragging after collapsing.

:::demo

splitter/collapsible

:::

Disable drag

When either panel disables resizable, dragging will be disabled.

:::demo

splitter/disableDrag

:::

Panel size

v-model:size can get the panel size.

:::demo

splitter/size

:::

Lazy ^(2.11.0)

When lazy is enabled, the panel size will not update in real time during dragging, but only after the drag ends.

:::demo

splitter/lazy

:::

Splitter API

Splitter Attributes

NameDescriptionTypeDefault
layoutLayout direction of the splitter^[enum]'horizontal' | 'vertical'horizontal
lazy ^(2.11.0)Whether to enable lazy mode^[boolean]false

Splitter Events

NameDescriptiontype
resize-startTriggered when starting to resize a panel, index is the drag bar index^[Function](index: number, sizes: number[]) => void
resizeTriggered while resizing a panel, index is the drag bar index^[Function](index: number, sizes: number[]) => void
resize-endTriggered when panel resizing ends, index is the drag bar index^[Function](index: number, sizes: number[]) => void
collapse ^(2.10.3)Triggered when a panel is collapsed, index is the drag bar index^[Function](index: number, type: 'start' | 'end', sizes: number[]) => void

SplitterPanel API

SplitterPanel Attributes

NameDescriptionTypeDefault
size / v-model:sizeSize of the panel (in pixels or percentage)^[string] / ^[number]-
minMinimum size of the panel (in pixels or percentage)^[string] / ^[number]-
maxMaximum size of the panel (in pixels or percentage)^[string] / ^[number]-
resizableWhether the panel can be resized^[boolean]true
collapsibleWhether the panel can be collapsed^[boolean]false

SplitterPanel Events

NameDescriptiontype
update:sizeTriggered when panel size changes^[Function](size: number) => void

SplitterPanel Slots

NameDescription
defaultDefault content of the panel
start-collapsibleCustom content for the start collapsible button
end-collapsibleCustom content for the end collapsible button

SplitterPanel Exposes

NameDescriptionType
splitterPanelRef ^(2.11.9)SplitterPanel html element^[object]Ref<HTMLDivElement>