Skip to content
Focsd homeFocsd homeFocsd
Forms

Splitter / resizable

Two resizable panes with a draggable divider.

  • Tag: focsd-splitter
  • Pattern: Window splitter
  • Category: Layout

Example

File list
Preview
HTML
<div class="full">
<focsd-splitter label="Resize file list" value="40" style="block-size: 10rem">
<div slot="start">File list</div>
<div slot="end">Preview</div>
</focsd-splitter>
</div>

Panes

Any number of resizable panes, side by side or stacked, with collapsible panes and a saved layout.

Inbox, Sent, Drafts Quarterly report draft Select a message to read it here.
HTML
<div class="full">
<focsd-splitter autosave="docs-mail" style="block-size: 14rem">
<focsd-splitter-pane label="Folders" size="25" min="15"
>Inbox, Sent, Drafts</focsd-splitter-pane
>
<focsd-splitter-pane label="Messages" min="20"
>Quarterly report draft</focsd-splitter-pane
>
<focsd-splitter-pane label="Preview" size="35" collapsible
>Select a message to read it here.</focsd-splitter-pane
>
</focsd-splitter>
</div>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/components/focsd-splitter.js';
</script>
<focsd-splitter label="Resize file list" value="40">…</focsd-splitter>

API

Attributes

AttributePropertyTypeDefault
labellabelstring—
valuevaluenumber50
minminnumber10
maxmaxnumber90
orientationorientation'horizontal' | 'vertical'horizontal
autosaveautosavestring—

Events

EventDescription
changeFired when the user commits a change to the value or state (two-slot markup only).

Slots

SlotDescription
(default)focsd-splitter-pane elements, one per pane.
endThe second pane.
startThe first pane (its size is value).

CSS parts

Style the inside of the component with ::part(), for example focsd-splitter::part(end).

PartDescription
endThe end element.
paneThe wrapper round each pane's slot (`display: contents`).
panesThe row (or column) of panes and separators.
separatorThe separator element.
startThe start element.

Accessibility

  • APG window splitter: the divider is a focusable role="separator" with aria-valuenow/min/max and aria-controls pointing at the start pane.

Keyboard

KeyAction
Arrow keysResize by 1% (10% with Shift)
Home / EndMinimum / maximum
EnterCollapse or restore

Panes

  • Each boundary is an APG window splitter: a focusable role="separator" named "Resize <pane label>", with aria-valuenow (the size of the pane before it) and that pane’s min and max as aria-valuemin and aria-valuemax.
  • Separators are vertical lines in a row of panes and horizontal lines with orientation="vertical"; aria-orientation says which.
  • A collapsed pane is hidden (display: none), so its content leaves the tab order until it is restored.
  • The visible line is thin, but the pointer target is 24 px wide.
  • With autosave, the sizes are kept in localStorage under focsd-splitter:<key> and come back on the next visit. Splitters can be nested.
  • Markup with start and end slots instead of panes keeps the two-pane behavior (change event).
  • orientation is new and applies to panes only. It does not reflect, so style on focsd-splitter[orientation=vertical] only when you set the attribute, not the property.

Keyboard

KeyAction
Arrow keysResize by 1% (Left and Right in a row, mirrored right to left; Up and Down in a column)
Shift + arrow keysResize by 10%
Home / EndThe pane before the separator to its minimum / maximum
EnterCollapse or restore the collapsible pane beside the separator