Back to Ant Design

Splitter

components/splitter/index.en-US.md

6.3.73.7 KB
Original Source

When To Use

Can be used to separate areas horizontally or vertically. When you need to freely drag and adjust the size of each area. When you need to specify the maximum and minimum width and height of an area.

Examples

<!-- prettier-ignore -->

<code src="./demo/size.tsx">Basic</code> <code src="./demo/control.tsx">Control mode</code> <code src="./demo/vertical.tsx">Vertical</code> <code src="./demo/collapsible.tsx">Collapsible</code> <code src="./demo/collapsibleIcon.tsx" version="5.27.0"> Control collapsible icons </code> <code src="./demo/multiple.tsx">Multiple panels</code> <code src="./demo/group.tsx">Complex combination</code> <code src="./demo/lazy.tsx" version="5.23.0">Lazy</code> <code src="./demo/customize.tsx" version="6.0.0">Customize</code> <code src="./demo/style-class.tsx" version="6.0.0">Custom semantic dom styling</code> <code src="./demo/reset.tsx" version="6.3.0">Double-clicked reset</code> <code src="./demo/nested-in-tabs.tsx" debug>Nested in tabs</code> <code src="./demo/debug.tsx" debug>Debug</code> <code src="./demo/size-mix.tsx" debug>Size Mix</code>

API

Common props ref:Common props

The Splitter component needs to calculate the panel size through its child elements, so its child elements only support Splitter.Panel.

Splitter

PropertyDescriptionTypeDefaultVersion
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-
collapsibleIconcustom collapsible icon{start: ReactNode; end: ReactNode}-6.0.0
draggerIconcustom dragger iconReactNode-6.0.0
layoutLayout directionhorizontal | verticalhorizontal-
lazyLazy modebooleanfalse5.23.0
onCollapseCallback when expanding or collapsing(collapsed: boolean[], sizes: number[]) => void-5.28.0
orientationOrientation directionhorizontal | verticalhorizontal
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-
verticalOrientation. Simultaneously existing with orientation, orientation takes prioritybooleanfalse
onDraggerDoubleClickCallback triggered when the dragger is double-clicked(index: number) => void-6.3.0
onResizePanel size change callback(sizes: number[]) => void--
onResizeEndDrag end callback(sizes: number[]) => void--
onResizeStartCallback before dragging starts(sizes: number[]) => void--

Panel

PropertyDescriptionTypeDefaultVersion
collapsibleQuick foldingboolean | { start?: boolean; end?: boolean; showCollapsibleIcon?: boolean | 'auto' }falseshowCollapsibleIcon: 5.27.0
defaultSizeInitial panel size support number for px or 'percent%' usagenumber | string--
maxMaximum threshold support number for px or 'percent%' usagenumber | string--
minMinimum threshold support number for px or 'percent%' usagenumber | string--
resizableWhether to enable drag and dropbooleantrue-
sizeControlled panel size support number for px or 'percent%' usagenumber | string--

Semantic DOM

<code src="./demo/_semantic.tsx" simplify="true"></code>

Design Token

<ComponentTokenTable component='Splitter'></ComponentTokenTable>