Introducing PrimeReact v11-alpha 🎉Discover Now

Splitter

Splitter is utilized to separate and resize panels.

Panel 1
Panel 2
preview

Installation#

npx shadcn@latest add @primereact/ui/splitter

Usage#

import { Splitter, SplitterPanel, SplitterGutter, SplitterThumb } from '@/components/ui/splitter';
<Splitter>
    <SplitterPanel />
    <SplitterGutter>
        <SplitterThumb />
    </SplitterGutter>
    <SplitterPanel />
</Splitter>

Examples#

Basic#

Divides a layout into resizable panels with a draggable divider.

Panel 1
Panel 2
basic-demo

Vertical#

Splitters can be combined to create advanced layouts.

Panel 1
Panel 2
vertical-demo

Size#

Initial dimension of a panel is percentage based and defined using the size property. In addition, minSize is provided to set a minimum value during a resize.

Panel 1
Panel 2
size-demo

Min Max Size#

Splitter panels can be resized within the limits defined by minSize and maxSize properties.

Panel 1
Panel 2
Panel 1
Panel 2
Panel 3
min-max-demo

Collapsible#

Splitter panels can be collapsed to a smaller size defined by the collapsedSize property if smaller than or equal to the minSize property.

Panel 1
Panel 2
Panel 1
Panel 2
collapsible-demo

Nested#

Splitters can be combined to create advanced layouts.

Panel 1
Panel 2
Panel 3
Panel 4
nested-demo

Resize Events#

Splitters can trigger events during the resize process, allowing you to handle custom logic when a panel is being resized.

onResizeStart: [50.0%, 50.0%]
onResize: [50.0%, 50.0%]
onResizeEnd: [50.0%, 50.0%]
onCollapse: –
Panel 1
Panel 2
resize-events-demo

Stateful#

Panel sizes can be persisted using the onResizeEnd callback. This example saves sizes to localStorage so they are restored on page reload.

Panel 1 (30.0%)
Panel 2 (70.0%)
stateful-demo

Disabled#

Splitter panels can be disabled to prevent resizing. This can be done for all panels by setting the disabled property on the root, or for specific gutters by setting the disabled property on the gutter.

Panel 1
Panel 2
Panel 3
Panel 1
Panel 2
Panel 3
disabled-demo

Custom#

Splitters can be customized with different styles.

Panel 1
Panel 2
custom-demo

Advanced#

  • Amy Elsner10:24 AM
    Q1 Marketing Report
    Hi team, I've attached the Q1 marketing report. Please review the campaign metrics and share your feedback before our meeting on Friday.
  • Bernardo Dominic9:15 AM
    Design System Update
    The new design tokens are ready for review. I've updated the color palette and typography scale based on our last discussion.
  • Ioni BowcherYesterday
    Sprint Retrospective Notes
    Here are the notes from yesterday's retro. Key takeaways: improve code review turnaround and schedule more pair programming sessions.
  • Stephen ShawYesterday
    Server Migration Plan
    The migration to the new cloud infrastructure is scheduled for next weekend. Please ensure all services have proper health checks configured.
  • Elwin SharvillMonday
    New Component Library Release
    Version 4.0 of the component library is now available. Major changes include accessibility improvements and new theming capabilities.

Q1 Marketing Report

10:24 AM
Amy Elsner

Hi team, I've attached the Q1 marketing report. Please review the campaign metrics and share your feedback before our meeting on Friday.

advanced-demo

API#

Sub-Components#

See Primitive API for SplitterRoot, SplitterPanel, SplitterGutter, SplitterThumb component documentation.

Hooks#

See Headless API for useSplitter hook documentation.

Accessibility#

See Splitter Primitive for WAI-ARIA compliance details and keyboard support.