Skip to content

SplitView

The SplitView component allows you to create a resizable split view layout with two panes separated by a draggable resizer. It supports both horizontal and vertical orientations, giving users full control over the layout proportions.

Preview

Pane A

This is Pane A. Drag the resizer to adjust the split.

Pane B

This is Pane B. The split view supports both horizontal and vertical orientations.

Features

  • Resizable Panes: Users can drag the resizer to adjust pane sizes
  • Dual Orientation: Supports both horizontal and vertical splits
  • Smooth Resizing: Fluid drag interaction with visual feedback
  • Customizable Styling: Style each pane and resizer independently
  • Flexible Content: Accepts any content in either pane
  • Keyboard Accessible: Resizer can be controlled with keyboard
  • Touch Support: Works on touch devices

Props

PropTypeRequiredDefaultDescription
aPaneStylestringNo""Custom CSS classes for the first pane (pane A)
bPaneStylestringNo""Custom CSS classes for the second pane (pane B)
splitViewStylestringNo""Custom CSS classes for the split view container
resizerStylestringNo""Custom CSS classes for the resizer element
resizerInnerStylestringNo""Custom CSS classes for the inner resizer element
isHorizontalbooleanNofalseDetermines the orientation (false = vertical, true = horizontal)

Slots

SlotDescription
aContent for the first pane (left pane in vertical mode, top pane in horizontal mode)
bContent for the second pane (right pane in vertical mode, bottom pane in horizontal mode)

Usage

Basic Implementation (Vertical Split)

Create a simple vertical split view:

vue
<template>
  <SplitView>
    <template #a>
      <div>Left Pane Content</div>
    </template>
    <template #b>
      <div>Right Pane Content</div>
    </template>
  </SplitView>
</template>

Horizontal Split

Create a horizontal split (top/bottom):

vue
<template>
  <SplitView :is-horizontal="true">
    <template #a>
      <div>Top Pane Content</div>
    </template>
    <template #b>
      <div>Bottom Pane Content</div>
    </template>
  </SplitView>
</template>

With Custom Styling

Apply custom styles to panes and resizer:

vue
<template>
  <SplitView
    a-pane-style="bg-blue-50 p-4"
    b-pane-style="bg-green-50 p-4"
    resizer-style="bg-gray-300"
  >
    <template #a>
      <div>Styled Left Pane</div>
    </template>
    <template #b>
      <div>Styled Right Pane</div>
    </template>
  </SplitView>
</template>

Orientation Modes

Vertical Split (Default)

┌─────────┬─────────┐
│         │         │
│ Pane A  │ Pane B  │
│  (a)    │  (b)    │
│         │         │
└─────────┴─────────┘
  • isHorizontal="false" (default)
  • Panes are side-by-side (left/right)
  • Resizer is vertical
  • Drag left/right to resize

Horizontal Split

┌───────────────────┐
│     Pane A (a)    │
├───────────────────┤
│     Pane B (b)    │
└───────────────────┘
  • isHorizontal="true"
  • Panes are stacked (top/bottom)
  • Resizer is horizontal
  • Drag up/down to resize

Developed with ❤️ by the DCC. Documentation released under the MIT License.