Pluto UIpluto/ui
Components

Split View

A clean, minimal split view component with smooth draggable divider, inspired by Edge mobile and Apple UI design.

// Code for split-view/basic

Installation

Loading installation instructions...

Usage

import { SplitView } from "@/components/pluto-ui/split-view"
<SplitView
  primary={<div>Left or top content</div>}
  secondary={<div>Right or bottom content</div>}
/>

Props

PropTypeDefaultDescription
primaryReactNoderequiredContent for the primary panel (left or top)
secondaryReactNoderequiredContent for the secondary panel (right or bottom)
direction"horizontal" | "vertical""horizontal"Split direction
defaultRationumber0.5Initial split ratio (0-1)
minPrimarySizenumber100Minimum size of primary panel in pixels
minSecondarySizenumber100Minimum size of secondary panel in pixels
classNamestringundefinedCustom className for the container
primaryClassNamestringundefinedCustom className for the primary panel
secondaryClassNamestringundefinedCustom className for the secondary panel
dividerClassNamestringundefinedCustom className for the divider
showHandlebooleantrueShow divider handle
onRatioChange(ratio: number) => voidundefinedCallback when split ratio changes

Examples

Basic Usage

Horizontal split view with two panels:

// Code for split-view/basic

Vertical Split

Vertical split view for mobile-friendly layouts:

// Code for split-view/vertical

Custom Handle

Minimal design without the handle:

// Code for split-view/custom-handle

With Callback

Track ratio changes in real-time:

// Code for split-view/with-callback

Features

  • Smooth Dragging: Smooth and responsive drag interactions for both mouse and touch
  • Touch-Friendly: Large touch targets optimized for mobile devices
  • Minimal Design: Clean, Apple-like UI with subtle divider and handle
  • Flexible Layouts: Support for both horizontal and vertical split directions
  • Constraints: Configurable minimum panel sizes to prevent unusable layouts
  • Theme-Aware: Fully supports light and dark themes
  • Accessible: Proper ARIA attributes and keyboard support

Notes

  • The divider is always draggable, even when the handle is hidden
  • The component automatically constrains the ratio based on minimum panel sizes
  • Touch events are handled with proper passive event listeners for smooth performance
  • The divider provides visual feedback during dragging (color change and handle scale)