Skip to the content
human-kit design
48 — Layout

Separator

A line between two groups, or one that the pointer and the keys move to size a pane.

Patient record

Notes Results Billing

Installation

pnpm dlx @human-kit/design add separator
npx @human-kit/design add separator
yarn dlx @human-kit/design add separator
bunx @human-kit/design add separator

The command copies the files to src/lib/components/ui/separator. It also installs the packages that the files import.

Usage

<script lang="ts">
	import * as Separator from '$lib/components/ui/separator';
</script>

<Separator.Root />

Examples

Splitter

Give it a value with bind:value, and size the pane before it from that value: the line becomes a grip the pointer drags and the keyboard moves, between min and max. Name it, and point aria-controls at the pane.

  • AM Ana María Ruiz IVF · day 9
  • LF Lucía Fernández Frozen transfer
  • VG Valentina Gómez Arango Egg freezing
  • SH Sofía Herrera First visit
  • ML Mariana López IUI · day 12
AM
Ana María Ruiz IVF, second cycle
Stimulation
Next
Ultrasound, 3 Dec, 8:30
Doctor
Dr. Julián Ortega
Follicles
Six at 15 mm or more

Guidelines

  • Use a horizontal separator between two groups stacked one over the other, and a vertical one between items side by side, as in a toolbar.
  • Reach for space first. A line earns its place where space alone does not say that the groups are apart.
  • Mark it decorative when the content already breaks there, as between two sections with headings.
  • A vertical separator takes the height of its row: give the row a height, as h-5, or it has none.
  • Use value for a pane the user sizes, as a list beside its detail. For a layout of several panes, use Resizable.

Accessibility

  • It is a role="separator", read as a break between two groups. A vertical one says so with aria-orientation="vertical".
  • decorative makes it role="none", which a screen reader skips.
  • A plain separator is not focusable. A splitter is a tab stop with aria-valuenow, aria-valuemin and aria-valuemax, and needs a name, as aria-label="Resize list".
  • On a splitter, the arrows of its axis move it by step, or by largeStep with Shift. Home and End send it to the ends, and Enter folds the pane and unfolds it.
  • The horizontal arrows flip on a right-to-left page.

API reference

PropTypeDefault
orientation'horizontal' | 'vertical'

Across its parent, or as tall as its row.

'horizontal'
decorativeboolean

A line to see only, which a screen reader skips. A separator with a value keeps its role.

false
valuenumber

Makes it a splitter: the size of the pane before it, between min and max. Bindable.

—
minnumber

The value with the pane folded.

0
maxnumber

The value with the pane at its largest.

100
stepnumber

The move of one arrow key.

1
largeStepnumber

The move of one arrow key with Shift.

10
onValueChange(value: number) => void

Called with the value after each move.

—
aria-controlsstring

The id of the pane the splitter sizes.

—
disabledboolean

Holds the splitter still. It stays a tab stop, and says it is disabled.

false
elementHTMLDivElement | null

The rendered element. Bindable.

—

Plus every attribute of a <div>, but the role and the ARIA values it sets.