VOOZH about

URL: https://ant.design/components/splitter/

⇱ Splitter - Ant Design


SpaceAnchor
👁 loading

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

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

PropertyDescriptionTypeDefaultVersionGlobal Config
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-6.0.06.0.0
collapsiblemotion to enable collapse animation, icon to customize collapse icons{ motion?: boolean; icon?: { start?: ReactNode; end?: ReactNode } }-6.4.0×
custom collapsible icon{start?: ReactNode; end?: ReactNode}-6.0.0×
destroyOnHiddenDestroy panel content when collapsed (size is 0). Applies to all panels, can be overridden per panelbooleanfalse6.4.0×
draggerIconcustom dragger iconReactNode-6.0.0×
Layout 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>-6.0.06.0.0
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--
destroyOnHiddenDestroy panel content when collapsed (size is 0). Overrides Splitter's destroyOnHiddenboolean-6.4.0
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

Design Token

Component TokenHow to use?
Token NameDescriptionTypeDefault Value
splitBarDraggableSizeDrag and drop the identity element sizenumber20
splitBarSizeDrag the element display sizenumber2
splitTriggerSizeDrag and drop trigger area sizenumber6
Global TokenHow to use?
Token NameDescriptionTypeDefault Value
colorFillThe darkest fill color is used to distinguish between the second and third level of fill color, and is currently only used in the hover effect of Slider.stringrgba(0,0,0,0.15)
colorPrimaryBrand color is one of the most direct visual elements to reflect the characteristics and communication of the product. After you have selected the brand color, we will automatically generate a complete color palette and assign it effective design semantics.string#1677ff
colorTextDefault text color which comply with W3C standards, and this color is also the darkest neutral color.stringrgba(0,0,0,0.88)
borderRadiusXSXS size border radius, used in some small border radius components, such as Segmented, Arrow and other components with small border radius.number2
controlHeightSMSM component heightnumber24
controlItemBgActiveControl the background color of control component item when active.string#e6f4ff
controlItemBgActiveHoverControl the background color of control component item when hovering and active.string#bae0ff
controlItemBgHoverControl the background color of control component item when hovering.stringrgba(0,0,0,0.04)
fontFamilyThe font family of Ant Design prioritizes the default interface font of the system, and provides a set of alternative font libraries that are suitable for screen display to maintain the readability and readability of the font under different platforms and browsers, reflecting the friendly, stable and professional characteristics.string-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'
fontSizeThe most widely used font size in the design system, from which the text gradient will be derived.number14
fontSizeSMSmall font sizenumber12
lineHeightLine height of text.number1.5714285714285714
motionDurationSlowMotion speed, slow speed. Used for large element animation interaction.string0.3s
motionEaseInOutPreset motion curve.string
cubic-bezier(0.645, 0.045, 0.355, 1)
zIndexPopupBaseBase zIndex of component like FloatButton, Affix which can be cover by large popupnumber1000
Basic

Initialize panel size, panel size limit.

Control mode

Control the size of the splitter. When one of the panels disables resizable, dragging will be disabled.

Vertical

Use vertical layout.

Collapsible

Set collapsible to enable collapse. Can through min to limit dragging to expand when collapsed.

Set collapsible.showCollapsibleIcon to control the display mode of collapsible icons.

5.27.0
Multiple panels

Multiple panels.

Complex combination

Complex combination panel, quick folding, prohibited from changing size

Lazy mode, dragging does not update the size immediately, but updates when released.

5.23.0

customize handle elements and style

6.0.0

You can customize the semantic dom style of Splitter by passing objects/functions through classNames and styles.

6.0.0

Double-click the dragger to reset the Splitter.Panel to its default size.

6.3.0
First
Second
First
Second
First
Second
First
Second
First
Second

ShowCollapsibleIcon:

First
Second
Third
Panel 1
Panel 2
Panel 3
Left
Top
Bottom
First
Second
First
Second
Panel 1
Panel 2
Panel 3
First
Second
First
Second
First
Second
Panel 1
Panel 2
Panel 3
First
Second
  • root
    6.0.0
    Root element with flex layout, width and height, alignment and stretch styles
  • panel
    6.0.0
    Panel element with flex basis, grow ratio and panel container styles
  • dragger
    6.0.0
    Drag control element with absolute positioning, user selection, z-index, center alignment, background color, hover and active states styles