0.1.0

Window Splitter

Window splitters divide a container into two resizable panes for code editor layouts, preview panels, or master-detail views.

Try it

Editor
Preview

Usage

Pass primary and secondary pane content. Set value to the primary pane percentage and orientation for horizontal or vertical splits.

import { RuiWindowSplitter } from '@ecopages/radiant-ui/window-splitter';
 
<RuiWindowSplitter
  value={50}
  orientation="horizontal"
  label="Split view"
  primary={<div>Editor</div>}
  secondary={<div>Preview</div>}
/>

Custom markup

<rui-window-splitter> coordinates any light-DOM tree that matches its query contract. The RuiWindowSplitter helper stamps these targets; it is not required.

import '@ecopages/radiant-ui/window-splitter';
 
<rui-window-splitter value={50} orientation="horizontal" label="Split view">
  <div data-ref="root" class="rui-window-splitter rui-window-splitter--horizontal">
    <div data-ref="primary" class="rui-window-splitter__pane">Editor</div>
    <div data-ref="separator" class="rui-window-splitter__separator" role="separator" tabindex={0}></div>
    <div data-ref="secondary" class="rui-window-splitter__pane">Preview</div>
  </div>
</rui-window-splitter>;

Do not set primary pane width / height or separator aria-valuenow — the host owns those.

Initial pane ratio

value sets the primary pane percentage, clamped between 20 and 80. Users can drag the splitter to adjust.

Orientation

Use horizontal for side-by-side panes and vertical for stacked editor/console layouts.

Theming

Window Splitter maps to semantic border, surface, and focus roles, never Tailwind palette steps:

PartCSS roles
Frame (rui-window-splitter)border, radius-container
Panesbackground, on-background, --space-inset
Separatorborder
Separator focusfocus-ring

Override at the theme layer, not in component CSS.

API

RuiWindowSplitter is a custom element (<rui-window-splitter>) that owns the separator and pane sizing; the RuiWindowSplitter JSX view projects the two panes.

Attributes

AttributeTypeDefaultDescription
valuenumber50Primary pane size as a percentage (clamped 20–80).
orientationhorizontal · verticalhorizontalSplit axis.
labelstringSplit viewAccessible name for the separator.

Light-DOM contract

TargetRequiredHost writesAuthor owns
[data-ref="root"]yesorientation modifier classeslayout wrapper
[data-ref="primary"]yesinline width or height from valuepane content
[data-ref="separator"]yesaria-orientation, aria-valuenow, aria-valuemin, aria-valuemax, aria-labelview seeds role="separator", tabIndex
[data-ref="secondary"]yes—second pane content

Nested hosts: none.

Events

EventDetailDescription
rui-splitter-change{ value: number }Emitted when the separator moves.

View helpers

ComponentTarget stampedNotes
RuiWindowSplitter[data-ref="root"], [data-ref="primary"], [data-ref="separator"], [data-ref="secondary"]primary and secondary props supply pane content.

Props

PropTypeDefaultDescription
primaryJsxRenderableFirst pane content for the RuiWindowSplitter view.
secondaryJsxRenderableSecond pane content.

CSS classes

Public BEM classes on the composed surface (documented via @cssclass on RuiWindowSplitterElement):

ClassDescription
.rui-window-splitterRoot surface.
.rui-window-splitter--horizontalSide-by-side panes.
.rui-window-splitter--verticalStacked panes.
.rui-window-splitter__paneA pane region.
.rui-window-splitter__separatorFocusable separator (role="separator").

Theme roles

PartCSS variables consumed
Frame--border, --radius-container
Panes--background, --on-background, --space-inset
Separator--border
Separator focus--focus-ring

Accessibility

  • The splitter handle is keyboard focusable and adjustable with arrow keys.
  • Provide label so screen readers identify the split region.
  • Ensure both panes remain usable at minimum sizes; avoid content that breaks at narrow widths.