Skip to content

Split

A style-only component that provides a flexible layout for dividing content into resizable panes. It is designed to work alongside other libraries to implement split view functionality.

Usage

Use Split when you need a side-by-side layout for content, such as editors, dashboards, or comparison panels. Avoid using Split for layouts where resizable content is unnecessary, as it may add unnecessary complexity.

Element hierarchy

The panel elements MUST be direct children of the split element. Otherwise, there will be some collisions with the styles.

API Reference

Component attubute(s)

x-h-split
x-h-split-panel
x-h-split-gutter

Attributes

x-h-split

AttributeTypeRequiredDescription
data-orientationhorizontal
vertical
trueOrientation of the layout.
data-variantborder
handle
falseStyle of the gutter. Default is handle.
data-lockedbooleanfalseLocks/disables the handle.

Examples

Horizontal split (2 panels)


html
<div class="size-full" x-h-split data-orientation="horizontal" data-variant="handle" data-locked="false">
  <div class="rounded-md border shadow-md" x-h-split-panel style="width: 50%">
    <div class="flex size-full items-center justify-center">Left panel</div>
  </div>
  <div x-h-split-gutter></div>
  <div class="rounded-md border shadow-md" x-h-split-panel style="width: 50%">
    <div class="flex size-full items-center justify-center">Right panel</div>
  </div>
</div>

Vertical split (2 panels)


html
<div class="size-full" x-h-split data-orientation="vertical" data-variant="handle" data-locked="false">
  <div class="rounded-md border shadow-md" x-h-split-panel style="height: 50%">
    <div class="flex size-full items-center justify-center">Left panel</div>
  </div>
  <div x-h-split-gutter></div>
  <div class="rounded-md border shadow-md" x-h-split-panel style="height: 50%">
    <div class="flex size-full items-center justify-center">Right panel</div>
  </div>
</div>

Border-style gutter

This is useful for split-window layouts. The gutter is visually thin but provides a wider interactive area for reliable mouse and touch interaction.

html
<div class="size-full" x-h-split data-orientation="vertical" data-variant="border" data-locked="false">
  <div x-h-split-panel style="height: 50%">
    <div class="flex size-full items-center justify-center">Left panel</div>
  </div>
  <div x-h-split-gutter></div>
  <div x-h-split-panel style="height: 50%">
    <div class="flex size-full items-center justify-center">Right panel</div>
  </div>
</div>