Introducing PrimeReact v11-alpha 🎉Discover Now

Splitter

An unstyled resizable panel layout component with pointer and keyboard-driven sizing.

Build fully custom resizable panel layouts with complete control over layout and styling.

Panel 1
Panel 2
basic-demo

Pre-styled Versions

Choose a pre-styled library to use Splitter with ready-made designs.
For hook-based usage without components, see the Headless API.

Features#

  • Compound component API with sub-components: Root, Panel, Gutter, Thumb
  • Pointer-based drag resizing with configurable step for keyboard arrow keys
  • Panel constraints via minSize, maxSize, collapsible, and collapsedSize
  • Nested splitter support for complex multi-directional layouts

Usage#

import { Splitter } from 'primereact/splitter';
<Splitter.Root>
    <Splitter.Panel></Splitter.Panel>
    <Splitter.Gutter>
        <Splitter.Thumb />
    </Splitter.Gutter>
    <Splitter.Panel></Splitter.Panel>
</Splitter.Root>

Behavior#

Polymorphic Rendering#

Use as on any sub-component to change the rendered HTML element.

<Splitter.Root as="section">
    <Splitter.Panel as="main">...</Splitter.Panel>
</Splitter.Root>

Render Function Children#

Sub-components accept a render function as children, providing access to the component instance.

<Splitter.Panel>{(instance) => <div>{instance.props.minSize}</div>}</Splitter.Panel>

Pass Through#

Some parts may not be visible in the preview depending on the component's current state.

Loading...
/* Select a part to see its CSS selector for custom styling */

API#

SplitterRoot#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SplitterRootInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SplitterRootInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSplitterRootInstance—
The instance to pass to the component.
ptSafeRecord<SplitterRootPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SplitterRootInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
panelsuseSplitterPanelConfig[]—
Declarative panel configuration array. When provided, the hook auto-registers panels from this config — no `registerPanel` calls needed. Each entry defines constraints for the panel at that index.
sizesnumber[]—
Controlled panel sizes as percentages (must sum to ~100). When provided, the splitter operates in controlled mode — sizes are driven by this prop and should be updated via onResize or onResizeEnd callbacks.
defaultSizesnumber[]—
Default initial panel sizes as percentages (must sum to ~100). Used for uncontrolled mode — sets the initial sizes on mount, after which internal state takes over.
orientation"horizontal" | "vertical"horizontal
Orientation of the panels.
disabledbooleanfalse
When true, disables all resize interactions.
stepnumber5
Step factor to increment/decrement the size of the panels while pressing the arrow keys.
onResizeStart(event: SplitterRootResizeStartEvent) => void—
Callback invoked when resize starts.
onResize(event: SplitterRootResizeEvent) => void—
Callback invoked during resize with current panel sizes.
onResizeEnd(event: SplitterRootResizeEndEvent) => void—
Callback invoked when resize ends.
onCollapse(event: SplitterRootCollapseEvent) => void—
Callback invoked when a panel collapses or expands.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-orientation"horizontal" or "vertical"
data-resizingPresent during a resize operation
data-disabledPresent when disabled

Defines passthrough(pt) options of Splitter component.

labeltypedescription
rootSplitterRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.
panelSplitterRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the panel's DOM element.
gutterSplitterRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the gutter's DOM element.
thumbSplitterRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the thumb's DOM element.

SplitterPanel#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SplitterPanelInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SplitterPanelInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSplitterPanelInstance—
The instance to pass to the component.
ptSafeRecord<SplitterPanelPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SplitterPanelInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
minSizenumber—
Minimum size of the element relative to 100%.
maxSizenumber—
Maximum size of the element relative to 100%.
collapsiblebooleanfalse
Whether the panel can be collapsed when resized below minSize.
collapsedSizenumber0
Size of the panel when collapsed, relative to 100%.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-orientation"horizontal" or "vertical"
data-indexPanel index number
data-resizingPresent during a resize operation

Defines passthrough(pt) options of SplitterPanel component.

labeltypedescription
rootSplitterPanelPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SplitterGutter#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SplitterGutterInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SplitterGutterInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSplitterGutterInstance—
The instance to pass to the component.
ptSafeRecord<SplitterGutterPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SplitterGutterInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
disabledbooleanfalse
When true, disables resize interactions for this gutter.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-orientation"horizontal" or "vertical"
data-resizingPresent during a resize operation
data-disabledPresent when disabled

Defines passthrough(pt) options of SplitterGutter component.

labeltypedescription
rootSplitterGutterPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

SplitterThumb#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SplitterThumbInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SplitterThumbInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSplitterThumbInstance—
The instance to pass to the component.
ptSafeRecord<SplitterThumbPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SplitterThumbInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-orientation"horizontal" or "vertical"
data-resizingPresent during a resize operation

Defines passthrough(pt) options of SplitterThumb component.

labeltypedescription
rootSplitterThumbPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

Accessibility#

Screen Reader#

Splitter gutter defines separator as the role with aria-orientation set to either horizontal or vertical. Each gutter provides aria-valuenow, aria-valuemin, and aria-valuemax to communicate panel sizes. Adjacent panels are linked via aria-controls.

Keyboard Support#

KeyFunction
tabMoves focus through the splitter bar.
down arrowMoves a vertical splitter down.
up arrowMoves a vertical splitter up.
left arrowMoves a horizontal splitter to the left.
right arrowMoves a horizontal splitter to the right.