Skip to content
Calm motion: animations on this site only fade, with no movement

SplitView ​

Master / detail with a draggable divider

A list on one side and what you picked on the other: mail, files, settings. On a wide view both show with a divider to drag. On a narrow one they take turns, with a Back button. For two panes that always show, use Resizable, which this is built on.

Basic

Docs review

The new component pages read well. Two typos on the Gantt page.

  • #master is the list and #detail is the content. The master slot gets open(). When the view is stacked, it shows the detail. When both panes are on screen, it does nothing. So the same click handler works at every width.
  • The view looks at its own width, not the window's: under breakpoint (default 560 px) it stacks. Resize the window and it switches without a reload.
  • Stacked, v-model:detail says which pane shows. Opening the detail moves focus to it. Back returns to the list and focuses it, and fires back. Nothing is left focused on a hidden element.
  • v-model is the master's width in % (min and max limit it, 20 to 60 by default). With storage-key the divider is remembered in localStorage. A missing, broken or out-of-range value is ignored.
  • The divider itself is Resizable's: a focusable separator, arrows move it, Home and End go to the limits, Enter or a double-click resets it.

Usage ​

ts
import { BlessSplitView } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
breakpointnumber560under this width (px of the view itself) the panes stack: one at a time
minnumber20
maxnumber60
storageKeystring—remember the divider in localStorage under this key
labelstring"Resize list"
labelsPartial<{ back: string; }>—
modelValuenumber35master pane width in %
detailbooleanfalsewhen stacked: is the detail showing (true) or the list (false)?

Events

NamePayloadDescription
update:modelValue[value: number]
back[]
update:detail[value: boolean]

Slots

NameScopeDescription
master{ open: () => boolean; stacked: boolean; }
detail{ stacked: boolean; }

Released under the MIT License. Character names and artwork belong to their owners.