Skip to content

LayoutSplitter ​

A flexible, resizable split-pane layout component for building horizontal or vertical split views with draggable handles. Supports multiple panels, min/max constraints, nested layouts, manual handle placement, and advanced use cases. Includes helper subcomponents and layouts.


Import ​

ts
import { LayoutSplitter } from '@odyssee/components';
// Helpers (optional)
import { HorizontalSplitter, VerticalSplitter, CodeEditorLayout, ThreePanelLayout } from '@odyssee/components';

Basic Usage (Horizontal Splitter) ​

Code Éditable
Résultat

Vertical Splitter ​

Code Éditable
Résultat

Three Panels (Vertical) ​

Code Éditable
Résultat

Nested Splitters ​

Code Éditable
Résultat

Manual Handle Placement ​

Code Éditable
Résultat

With Min/Max Constraints ​

Code Éditable
Résultat

Props ​

LayoutSplitter Props ​

NameTypeDefaultDescription
childrenPulse.JSX.Element | Pulse.JSX.Element[]—Panels (SplitterPanel components)
direction'horizontal' | 'vertical''horizontal'Split direction
handleTemplatePulse.JSX.Element | string—Custom handle template
handleClassesstring—Custom handle CSS classes
manualHandlesbooleanfalseIf true, handles must be placed manually
onResize(sizes: number[]) => void—Callback when panel sizes change
disabledbooleanfalseDisable resizing
classNamestring—Additional CSS classes
idstringautoDOM id (auto-generated if not provided)
stylestring—Inline styles
...restany—Other props are spread to the root <div>

LayoutSplitter.Panel Props ​

NameTypeDefaultDescription
childrenPulse.JSX.Element | ...—Content to render inside the panel
sizenumber | Signal<number>—Initial size (percentage 0-100)
minSizenumber—Minimum size (percentage)
maxSizenumber—Maximum size (percentage)
limitReachedClassstring—Class when min/max limit is reached
classNamestring—Additional CSS classes
idstring—DOM id
stylestring—Inline styles
...restany—Other props are spread to the root <div>

LayoutSplitter.Handle Props ​

NameTypeDefaultDescription
direction'horizontal' | 'vertical'inheritedHandle direction
childrenPulse.JSX.Element | string—Custom handle content
classNamestring—Additional CSS classes
idstring—DOM id
...restany—Other props are spread to the root <div>

Helper Components ​

  • HorizontalSplitter: Shortcut for <LayoutSplitter direction='horizontal' />
  • VerticalSplitter: Shortcut for <LayoutSplitter direction='vertical' />
  • CodeEditorLayout: Prebuilt layout for sidebar + editor + preview (horizontal)
  • ThreePanelLayout: Prebuilt vertical layout with top, middle, and bottom panels

Accessibility ​

  • Panels are rendered as semantic <div> containers.
  • Handles are visually distinct and keyboard focusable if made interactive.
  • Ensure sufficient color contrast for handles and panel content.
  • Resizing is managed by Preline JS; ensure keyboard accessibility if required.

Best Practices ​

  • Use direction to control split orientation.
  • Use minSize/maxSize to prevent panels from becoming too small or too large.
  • Use manualHandles for advanced layouts or custom handle placement.
  • Nest splitters for complex layouts (e.g., IDEs, dashboards).
  • Always provide clear content in each panel for accessibility.

Subcomponents & Helpers ​

  • LayoutSplitter.Panel: Defines a resizable panel.
  • LayoutSplitter.Handle: Custom or manual handle between panels.
  • HorizontalSplitter / VerticalSplitter: Quick splitters.
  • CodeEditorLayout: Sidebar + editor + preview.
  • ThreePanelLayout: Top, middle, bottom panels.

Released under the MIT License.