Splitter
Resizable panels: sizes, limits, collapsing and nested areas.
When to use
Splitter divides the work area into panels, the size of which can be changed by the user. It is suitable for editor, preview and details area. The container needs certain dimensions: the vertical composition must have an accessible height.
Declare panels with Splitter.Panel inside Splitter, or pass an items array with children snippets. The array takes precedence when supplied. Panel identity follows position.
Panel dimensions
size, defaultSize, min and max accept a number in px or a percentage string. The unspecified remainder is distributed among the panels. defaultSize is read at creation; further changes can be controlled via size.
| Problem | Setting | Example |
|---|---|---|
| Split restricted area | Splitter.Panel, min, max |
Two panels with restrictions |
| Store dimensions in app | size, onResize |
Managed Dimensions |
| Split area from top to bottom | orientation="vertical" |
Vertical division |
| Create multiple levels | Nested Splitter |
Nested areas |
| Apply size after release | lazy, onResizeEnd |
Delayed resizing |
If at least one panel has size, the entire group becomes manageable. Accept the suggested numbers from the callback and update the sizes of the corresponding items. Keeping the same size allows you to reject the change; For external reset, percentage values can be transferred again.
resizable=false prevents changes to the adjacent border, rather than hiding the panel. For drag, both adjacent panels must allow resize. orientation takes precedence over vertical.
Changing and collapsing
A regular drag reports onResizeStart, intermediate onResize and onResizeEnd. lazy shows the preliminary line and applies the result when completed; save sizes via onResizeEnd since the intermediate onResize is not called.
collapsible panel allows collapsing at start/end and sets the visibility of buttons. General collapsible.motion includes animation, icon changes icons. onCollapse reports an array of collapsed states and sizes after change events.
onDraggerDoubleClick gets the border index. Reset example itself restores the sizes in the application; callback does not automatically replace state.
destroyOnHidden defaults to false: if size is zero, the content is stored in the DOM. This preserves local state, but the hidden field may remain in Tab order - a limitation that is also reproduced in the benchmark. Example of hidden content uses true. Keep important values outside the panel being deleted; The panel's local destroyOnHidden takes precedence over the global one.
Design and availability
classNames/styles support root, panel and dragger object or function from props. styles accepts CSS strings and objects. classNames.dragger.active is used during drag, styles.dragger.active is not used yet. Semantic example shows the current settings and ConfigProvider.splitter.
theme.components.Splitter applies splitBarSize, splitTriggerSize and splitBarDraggableSize to the border and capture area. Local styles refine the design. draggerIcon changes the icon, and null/false leaves an empty custom wrapper instead of the standard content.
The border has role=separator, orientation and percentage aria-valuenow/min/max. Drag supports mouse and touch; resizing with arrows has not yet been implemented. Collapse buttons are accessible from the keyboard. Their names are fixed in the current package; the override via aria-label custom icon from the 6.7 documentation has not been carried over.
bind:nativeElement returns the root div after mount. To change the composition of panels, take into account the positional identity of items and store editor data in the application state.
A non-empty local prefixCls changes the classes of root, panels, separator, collapse buttons, preview and mask. The empty string and undefined inherit ConfigProvider.prefixCls with the -splitter suffix, defaulting to ant-splitter. Semantic callbacks receive the initial local value of prefixCls. Example of prefixes contains nested areas with one local class, separate lazy preview and saving dimensions and editor.
The preview service variable uses a common prefix without dots: --suite-splitter-bar-preview-offset. The local class and theme.cssVar.prefix have no effect on it. CSS is isolated by class/namespace pair, so nested scopes don't read each other's offset. The CSS registration order dependence is not reproduced in the reference. Changing the prefix preserves the active drag, panels and their contents; destroyOnHidden continues to control the removal of collapsed content separately.
Splitter uses design tokens from the current theme for its appearance.
Examples
Two panels with restrictions
Splitter.Panel declares panels inside Splitter. Numbers specify pixels and percentage strings specify a share of the available space. min and max constrain dragging.
<script lang="ts">
import { Splitter } from '@woodger/antd';
let result = $state(("Drag the separator"));
</script>
<style>
.surface {
height: 220px;
overflow: hidden;
border: 1px solid var(--ant-color-border-secondary);
border-radius: 8px;
}
.pane {
display: grid;
height: 100%;
min-width: 0;
box-sizing: border-box;
align-content: center;
padding: 12px;
overflow-wrap: anywhere;
background: var(--ant-color-fill-quaternary);
}
output {
display: block;
margin-top: 16px;
overflow-wrap: anywhere;
}
</style>
<div class="surface">
<Splitter onResizeEnd={next => { result = next.map(Math.round).join(' / ') + ' px'; }}>
<Splitter.Panel defaultSize="40%" min="20%" max="80%">
<div class="pane">{("First panel")}</div>
</Splitter.Panel>
<Splitter.Panel min="20%">
<div class="pane">{("Second panel")}</div>
</Splitter.Panel>
</Splitter>
</div>
<output aria-label={("Result of Splitter change")}>{result}</output>
Controlled dimensions
If the size of at least one panel is specified, the application takes the dimensions in onResize. The prohibition of acceptance leaves the previous geometry.
<script lang="ts">
import { Button, Splitter, type SplitterSize } from '@woodger/antd';
let sizes = $state<SplitterSize[]>(['50%', '50%']);
let frozen = $state(false);
function resize(next: number[]) {
if (!frozen) sizes = next;
}
</script>
<style>
.surface {
height: 220px;
overflow: hidden;
border: 1px solid var(--ant-color-border-secondary);
border-radius: 8px;
}
.pane {
display: grid;
height: 100%;
min-width: 0;
box-sizing: border-box;
align-content: center;
padding: 12px;
overflow-wrap: anywhere;
background: var(--ant-color-fill-quaternary);
}
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
label {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
output {
display: block;
margin-top: 16px;
overflow-wrap: anywhere;
}
</style>
{#snippet first()}<div class="pane">{("First panel")}</div>{/snippet}
{#snippet second()}<div class="pane">{("Second panel")}</div>{/snippet}
<div class="controls"><label><input type="checkbox" bind:checked={frozen} />{(" Do not accept changes")}</label><Button onclick={() => {
sizes = [
'50%',
'50%'
];
}}>{("Reset dimensions")}</Button></div>
<div class="surface"><Splitter items={([{
children: first,
size: sizes[0],
min: '20%'
}, { children: second, size: sizes[1], min: '20%' }])} onResize={resize} /></div>
<output aria-label={("Accepted Dimensions of Splitter")}>{sizes.map(
value => typeof value === 'number' ? Math.round(value) + 'px' : value
).join(' / ')}</output>
Vertical split
orientation="vertical" places panels from top to bottom. The ARIA orientation of the separator itself becomes horizontal.
<script lang="ts">
import { Splitter } from '@woodger/antd';
</script>
<style>
.surface {
height: 220px;
overflow: hidden;
border: 1px solid var(--ant-color-border-secondary);
border-radius: 8px;
}
.pane {
display: grid;
height: 100%;
min-width: 0;
box-sizing: border-box;
align-content: center;
padding: 12px;
overflow-wrap: anywhere;
background: var(--ant-color-fill-quaternary);
}
</style>
{#snippet first()}<div class="pane">{("First panel")}</div>{/snippet}
{#snippet second()}<div class="pane">{("Second panel")}</div>{/snippet}
<div class="surface"><Splitter orientation="vertical" items={([{
children: first,
defaultSize: '40%',
min: '20%'
}, { children: second, min: '20%' }])} /></div>
Rolling up panels
collapsible includes buttons at the divider. onCollapse reports an array of states and suggested sizes.
<script lang="ts">
import { Splitter } from '@woodger/antd';
let result = $state(("Panels open"));
</script>
<style>
.surface {
height: 220px;
overflow: hidden;
border: 1px solid var(--ant-color-border-secondary);
border-radius: 8px;
}
.pane {
display: grid;
height: 100%;
min-width: 0;
box-sizing: border-box;
align-content: center;
padding: 12px;
overflow-wrap: anywhere;
background: var(--ant-color-fill-quaternary);
}
output {
display: block;
margin-top: 16px;
overflow-wrap: anywhere;
}
</style>
{#snippet first()}<div class="pane">{("First panel")}</div>{/snippet}
{#snippet second()}<div class="pane">{("Second panel")}</div>{/snippet}
<div class="surface"><Splitter collapsible={{ motion: true }} items={([{
children: first,
collapsible: true
}, { children: second, collapsible: true }])} onCollapse={(
collapsed,
sizes
) => {
result = collapsed.map((
value,
index
) => `${index + 1}: ${value ? "hidden" : "visible"} (${Math.round(
sizes[index]
)}px)`).join(', ');
}} /></div>
<output aria-label={("Collapse Splitter")}>{result}</output>
Visibility of minimize buttons
showCollapsibleIcon accepts true, false or auto. This is the visibility of the buttons, not the state of the panels.
<script lang="ts">
import { Splitter, type SplitterIconVisibility } from '@woodger/antd';
let visibility = $state<SplitterIconVisibility>('auto');
</script>
<style>
.surface {
height: 220px;
overflow: hidden;
border: 1px solid var(--ant-color-border-secondary);
border-radius: 8px;
}
.pane {
display: grid;
height: 100%;
min-width: 0;
box-sizing: border-box;
align-content: center;
padding: 12px;
overflow-wrap: anywhere;
background: var(--ant-color-fill-quaternary);
}
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
label {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
</style>
{#snippet first()}<div class="pane">{("First panel")}</div>{/snippet}
{#snippet second()}<div class="pane">{("Second panel")}</div>{/snippet}
<div
class="controls"
>
<label>{("Collapse buttons ")}<select
bind:value={visibility}
>
<option
value="auto"
>
{("On hover")}
</option>
<option value={true}>
{("Always")}
</option>
<option value={false}>
{("Hide")}
</option>
</select></label>
</div>
<div class="surface"><Splitter items={([{
children: first, collapsible: {
start: true,
end: true,
showCollapsibleIcon: visibility
}
}, { children: second, collapsible: true }])} /></div>
Multiple panels
A separator appears between each pair of neighbors. resizable=false for the panel prohibits changing both adjacent borders.
<script lang="ts">
import { Splitter } from '@woodger/antd';
</script>
<style>
.surface {
height: 220px;
overflow: hidden;
border: 1px solid var(--ant-color-border-secondary);
border-radius: 8px;
}
.pane {
display: grid;
height: 100%;
min-width: 0;
box-sizing: border-box;
align-content: center;
padding: 12px;
overflow-wrap: anywhere;
background: var(--ant-color-fill-quaternary);
}
</style>
{#snippet first()}<div class="pane">{("First panel")}</div>{/snippet}
{#snippet second()}<div class="pane">{("Second panel")}</div>{/snippet}
{#snippet third()}<div class="pane">{("Third panel")}</div>{/snippet}
<div class="surface"><Splitter items={([{
children: first,
defaultSize: '30%',
min: '15%'
}, { children: second, defaultSize: '40%', min: '15%' }, { children: third, min: '15%' }])} /></div>
Nested areas
The horizontal splitter is combined with the vertical splitter in the second panel. Each container manages its own dimensions.
<script lang="ts">
import { Splitter } from '@woodger/antd';
</script>
<style>
.surface {
height: 220px;
overflow: hidden;
border: 1px solid var(--ant-color-border-secondary);
border-radius: 8px;
}
.pane {
display: grid;
height: 100%;
min-width: 0;
box-sizing: border-box;
align-content: center;
padding: 12px;
overflow-wrap: anywhere;
background: var(--ant-color-fill-quaternary);
}
</style>
{#snippet first()}<div class="pane">{("First panel")}</div>{/snippet}
{#snippet second()}<div class="pane">{("Second panel")}</div>{/snippet}
{#snippet third()}<div class="pane">{("Third panel")}</div>{/snippet}
{#snippet nested()}<Splitter orientation="vertical" items={([{
children: second,
min: '20%'
}, { children: third, min: '20%' }])} />{/snippet}
<div class="surface"><Splitter items={([{ children: first, min: '20%' }, {
children: nested,
min: '20%'
}])} /></div>
Delayed resizing
lazy shows the preposition line. The geometry and onResizeEnd are updated when released; onResize is not called in this mode.
<script lang="ts">
import { Splitter } from '@woodger/antd';
let result = $state(("Dimensions have not been changed yet"));
</script>
<style>
.surface {
height: 220px;
overflow: hidden;
border: 1px solid var(--ant-color-border-secondary);
border-radius: 8px;
}
.pane {
display: grid;
height: 100%;
min-width: 0;
box-sizing: border-box;
align-content: center;
padding: 12px;
overflow-wrap: anywhere;
background: var(--ant-color-fill-quaternary);
}
output {
display: block;
margin-top: 16px;
overflow-wrap: anywhere;
}
</style>
{#snippet first()}<div class="pane">{("First panel")}</div>{/snippet}
{#snippet second()}<div class="pane">{("Second panel")}</div>{/snippet}
<div class="surface"><Splitter lazy items={([{
children: first,
defaultSize: '40%',
min: '20%'
}, { children: second, min: '20%' }])} onResizeEnd={next => {
result = next.map(
Math.round
).join(' / ') + ' px';
}} /></div>
<output aria-label={("Delayed Dimensions Splitter")}>{result}</output>
Own icons
draggerIcon and collapsible.icon accept strings or snippets. The names of the buttons of the current package remain standard Toggle start/end panel.
<script lang="ts">
import { Splitter } from '@woodger/antd';
</script>
<style>
.surface {
height: 220px;
overflow: hidden;
border: 1px solid var(--ant-color-border-secondary);
border-radius: 8px;
}
.pane {
display: grid;
height: 100%;
min-width: 0;
box-sizing: border-box;
align-content: center;
padding: 12px;
overflow-wrap: anywhere;
background: var(--ant-color-fill-quaternary);
}
</style>
{#snippet first()}<div class="pane">{("First panel")}</div>{/snippet}
{#snippet second()}<div class="pane">{("Second panel")}</div>{/snippet}
{#snippet handle()}<span aria-hidden="true">⋮</span>{/snippet}
{#snippet startIcon()}<span aria-hidden="true">−</span>{/snippet}
{#snippet endIcon()}<span aria-hidden="true">+</span>{/snippet}
<div class="surface"><Splitter draggerIcon={handle} collapsible={{
icon: {
start: startIcon,
end: endIcon
}
}} items={([
{
children: first,
collapsible: true
},
{ children: second, collapsible: true }
])} /></div>
Semantic slots and provider
root, panel and dragger are designed separately. ConfigProvider.splitter sets the general style, local functions refine it.
<script lang="ts">
import { ConfigProvider, Splitter } from '@woodger/antd';
</script>
<style>
.surface {
height: 220px;
overflow: hidden;
border: 1px solid var(--ant-color-border-secondary);
border-radius: 8px;
}
.pane {
display: grid;
height: 100%;
min-width: 0;
box-sizing: border-box;
align-content: center;
padding: 12px;
overflow-wrap: anywhere;
background: transparent;
}
</style>
{#snippet first()}<div class="pane">{("First panel")}</div>{/snippet}
{#snippet second()}<div class="pane">{("Second panel")}</div>{/snippet}
<ConfigProvider splitter={{
styles: {
root: 'border-radius:8px',
panel: 'background:var(--ant-color-primary-bg)'
}
}}>
<div class="surface"><Splitter classNames={{ panel: 'custom-split-panel' }} styles={(
{ props }
) => ({
dragger: {
default: `background:${props.orientation === 'horizontal' ? '#722ed1' : '#08979c'}`
}
})} items={([{ children: first }, { children: second }])} /></div>
</ConfigProvider>
Double press reset
onDraggerDoubleClick reports the border index. The application returns the managed sizes to equal shares.
<script lang="ts">
import { Splitter, type SplitterSize } from '@woodger/antd';
let sizes = $state<SplitterSize[]>(['30%', '70%']);
let resets = $state(0);
function reset() {
sizes = ['50%', '50%'];
resets += 1;
}
</script>
<style>
.surface {
height: 220px;
overflow: hidden;
border: 1px solid var(--ant-color-border-secondary);
border-radius: 8px;
}
.pane {
display: grid;
height: 100%;
min-width: 0;
box-sizing: border-box;
align-content: center;
padding: 12px;
overflow-wrap: anywhere;
background: var(--ant-color-fill-quaternary);
}
output {
display: block;
margin-top: 16px;
overflow-wrap: anywhere;
}
</style>
{#snippet first()}<div class="pane">{("First panel")}</div>{/snippet}
{#snippet second()}<div class="pane">{("Second panel")}</div>{/snippet}
<div class="surface"><Splitter items={([{
children: first,
size: sizes[0],
min: '20%'
}, { children: second, size: sizes[1], min: '20%' }])} onResize={next => {
sizes = next;
}} onDraggerDoubleClick={reset} /></div>
<output aria-label={("Resets Splitter")}>{resets}</output>
Both Splitter use the same local class in different areas. Deferred resize and its preview remain independent; the draft is stored outside the panel being deleted.
Local and general prefix
Nested areas with one class, independent lazy preview and saving dimensions and editor.
<script lang="ts">
import { Checkbox, ConfigProvider, Input, Splitter } from '@woodger/antd';
let custom = $state(true);
let local = $state(true);
let draft = $state('');
let collapsed = $state(false);
let sizes = $state(("After resize"));
let innerSizes = $state(("After resize"));
const prefix = $derived(custom ? 'suite' : 'ant');
</script>
<style>
.example {
display: grid;
gap: 20px;
min-width: 0;
}
.controls {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.surface {
height: 240px;
min-width: 0;
overflow: hidden;
border: 1px solid var(--ant-color-border-secondary);
border-radius: 8px;
}
.pane {
display: grid;
box-sizing: border-box;
height: 100%;
min-width: 0;
align-content: start;
gap: 8px;
padding: 12px;
background: var(--ant-color-fill-quaternary);
overflow-wrap: anywhere;
}
p { margin: 0; }
output { overflow-wrap: anywhere; }
</style>
{#snippet editor()}
<div class="pane">
<span>{("Editor")}</span>
<Input bind:value={draft} aria-label={("Draft Splitter with prefix")} />
</div>
{/snippet}
{#snippet nested()}
<ConfigProvider prefixCls="neighbor" style="height: 100%">
<Splitter class="prefix-splitter-inner" prefixCls={local ? 'project-splitter' : ''}
orientation="vertical" lazy items={([
{ children: "Nested panel 1", defaultSize: '50%', min: '10%' },
{ children: "Nested panel 2", min: '10%' }
])} onResizeEnd={next => { innerSizes = next.map(Math.round).join(' / ') + ' px'; }} />
</ConfigProvider>
{/snippet}
<div class="example">
<div class="controls">
<Checkbox bind:checked={custom}>{("Common prefix Splitter suite")}</Checkbox>
<Checkbox bind:checked={local}>{("Local Prefix Splitter")}</Checkbox>
</div>
<ConfigProvider prefixCls={prefix} theme={{ cssVar: { prefix: 'splitter-theme' } }}>
<div class="surface">
<Splitter class="prefix-splitter-main" prefixCls={local ? 'project-splitter' : ''}
lazy destroyOnHidden collapsible={{ motion: false }} items={([
{
children: editor, defaultSize: '45%', min: '20%', max: '80%',
collapsible: { start: true, end: true, showCollapsibleIcon: true }
},
{
children: nested, min: '20%',
collapsible: { start: true, end: true, showCollapsibleIcon: true }
}
])} onResizeEnd={next => { sizes = next.map(Math.round).join(' / ') + ' px'; }}
onCollapse={next => { collapsed = next[0]; }} />
</div>
</ConfigProvider>
<output
aria-label={("Prefix Splitter")}
>{("\n General: ")}{prefix}{("; class: ")}{(local ? 'project-splitter' : prefix + '-splitter')};
{(collapsed ? "editor minimized" : "editor revealed")}{("; dimensions: ")}{sizes}
</output>
<output aria-label={("Nested resize with prefix")}>{innerSizes}</output>
<p>
{("Both Splitter use the same local class in different areas. Deferred resize and its preview remain independent; the draft is stored outside the panel being deleted.")}
</p>
</div>
Drag the separator or collapse the panel with the arrow.
Dimensions are limited to twenty percent of the area.
Project panels
Saved review example: changing direction, restrictions and the result of resizing.
<script lang="ts">
import { Splitter } from '@woodger/antd';
let vertical = $state(false);
let sizes = $state<number[]>([]);
</script>
<style>
.controls {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 16px;
}
.surface {
height: 240px;
border: 1px solid var(--ant-color-border-secondary);
border-radius: 8px;
overflow: hidden;
}
.pane {
display: grid;
height: 100%;
box-sizing: border-box;
align-content: center;
gap: 8px;
padding: 16px;
overflow-wrap: anywhere;
}
.pane p {
margin: 0;
color: var(--ant-color-text-secondary);
}
output {
display: block;
margin-top: 16px;
}
</style>
{#snippet first()}
<div class="pane"><strong>
{("First panel")}
</strong><p>
{("Drag the separator or collapse the panel with the arrow.")}
</p></div>
{/snippet}
{#snippet second()}
<div class="pane"><strong>
{("Second panel")}
</strong><p>
{("Dimensions are limited to twenty percent of the area.")}
</p></div>
{/snippet}
<label class="controls"><input type="checkbox" bind:checked={vertical} />{(" Vertical split")}</label>
<div class="surface">
<Splitter
orientation={vertical ? 'vertical' : 'horizontal'}
items={([
{ children: first, defaultSize: '40%', min: '20%', collapsible: true },
{ children: second, min: '20%', collapsible: true }
])}
onResizeEnd={next => { sizes = next; }}
/>
</div>
<output aria-label={("Panel dimensions")}>{(sizes.length ? `${sizes.map(
Math.round
).join(' / ')} px` : "Change panel sizes")}</output>
API
Themes of the ant.design live page are mapped to the public API of the installed package. Full definitions of Props are in @woodger/antd.
| Theme | Example or limitation |
|---|---|
| CSS prefixes | General and local prefix, nested areas and independent lazy preview. |
| Basic | Two panels with min/max. |
| Control mode | Acceptance of dimensions by application. |
| Vertical | Vertical division. |
| Collapsible | Buttons, motion and callbacks. |
| Control collapsible icons | auto/true/false. |
| Multiple panels | Three adjacent panels. |
| Complex combination | Nested division. |
| Lazy | Dimensions change upon release. |
| Customize | Own icons. |
| Custom semantic dom styling | ConfigProvider and semantic slots. |
| Double-clicked reset | Controlled aspect ratio reset. |
| Property | Description | Type | Default |
|---|---|---|---|
prefixCls | Full local prefix of root, panels, separator and preview. The empty string and undefined inherit the same prefix. styles/classNames get the original local prefix; namespace preview depends on ConfigProvider.prefixCls. | string | ConfigProvider + -splitter |
items | Array of panels with text content or snippets. When provided, items takes precedence over nested Splitter.Panel declarations. | SplitterPanelProps[] | [] |
orientation | Panel axis: horizontal or vertical. | horizontal | vertical | horizontal |
lazy | Deferred resize until the pointer is released. | boolean | false |
destroyOnHidden | Deleting the contents of a collapsed panel; The panel parameter takes precedence. | boolean | false |
collapsible | Animation of icons collapsing and snippets. | motion/icon config | — |
draggerIcon | Your own icon; null/false create an empty wrapper. | SplitterContent | Spinner |
onResizeStart | Start of dragging, dimensions in px. | (sizes: number[]) => void | — |
onResize | Suggested sizes for resize and collapse; the application accepts them for controlled size. | (sizes: number[]) => void | — |
onResizeEnd | Completing the change. lazy reports suggested sizes without onResize. | (sizes: number[]) => void | — |
onCollapse | After onResize/onResizeEnd when collapsing. | (collapsed, sizes) => void | — |
onDraggerDoubleClick | Double click on the border, including resizable=false. | (index: number) => void | — |
classNames | Classes root/panel/dragger, dragger has default/active. | SplitterSemantic<SplitterClassSlots> | — |
styles | CSS strings and objects for root, panel, and dragger.default. | SplitterSemantic<SplitterStyleSlots> | — |
nativeElement | bind:nativeElement instead of React SplitterRef. | HTMLDivElement | — |
Panel Options
size enables controlled mode for the entire group; defaultSize specifies the initial size. min/max limit the size. resizable by default true; both adjacent panels must allow modification. collapsible - boolean or start/end/showCollapsibleIcon object. destroyOnHidden overrides the group setting. class/style refers to the panel; the content is passed to children.
Semantic DOM
root contains panel and dragger between neighbors. Semantic classNames/styles are available via local props and ConfigProvider.splitter. dragger.default sets the normal style; classNames.dragger.active is applied during dragging, styles.dragger.active is not used in the installed implementation.
The border has role="separator", aria-orientation and percentage aria-valuenow/min/max. Drag and drop supports mouse and touch; There is no resizing using keyboard arrows yet. Collapse buttons are available on Tab, Enter and Space.
In the package version, the names of the buttons are fixed as Toggle start/end panel. The ability to override the name via aria-label custom icon introduced in React 6.7 has not been carried over.
Registration tokens
There are three component tokens in the table corresponding to ant.design. theme.components.Splitter is applied to the border and capture area sizes. Additional styling of root/panel/dragger is shown through semantic styles and ConfigProvider.splitter.
| Token | Purpose |
|---|---|
splitBarDraggableSize | Border capture area. |
splitBarSize | Separator thickness. |
splitTriggerSize | Collapse button size. |
| Token | Current value |
|---|---|
colorFill | rgba(0,0,0,0.15) |
colorPrimary | #2f54eb |
colorPrimaryBorder | #adc6ff |
colorText | rgba(0,0,0,0.88) |
borderRadiusXS | 2 |
controlHeightSM | 24 |
controlItemBgActive | #f0f5ff |
controlItemBgActiveHover | #d6e4ff |
controlItemBgHover | rgba(0,0,0,0.04) |
fontFamily | -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' |
fontSize | 14 |
fontSizeSM | 12 |
lineHeight | 1.5714285714285714 |
lineWidthFocus | 3 |
motionDurationSlow | 0.3s |
motionEaseInOut | cubic-bezier(0.645, 0.045, 0.355, 1) |
zIndexPopupBase | 1000 |
FAQ
Why doesn't controlled Splitter change sizes?
Accept the proposed values in onResize, and if lazy - in onResizeEnd, and update the size of the panels.
How to set dimensions?
Numbers - px, percentage lines - container share. defaultSize specifies only the initial value.
Is it possible to hide the panel using resizable=false?
No, it prohibits resizing adjacent borders. Collapse is set to collapsible, content saving is set to destroyOnHidden.
What's with the focus in the hidden panel?
When the DOM is saved, the field can remain in Tab order. destroyOnHidden=true deletes the content and its local state; Store important data in the application.
How to save dimensions in lazy?
Via onResizeEnd. The preline does not resize the panels and does not call intermediate onResize.