Separator
A line between two groups, or one that the pointer and the keys move to size a pane.
Patient record
Installation
pnpm dlx @human-kit/design add separatornpx @human-kit/design add separatoryarn dlx @human-kit/design add separatorbunx @human-kit/design add separatorThe 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
- 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
decorativewhen 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
valuefor 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 witharia-orientation="vertical". decorativemakes itrole="none", which a screen reader skips.- A plain separator is not focusable. A splitter is a tab stop with
aria-valuenow,aria-valueminandaria-valuemax, and needs a name, asaria-label="Resize list". - On a splitter, the arrows of its axis move it by
step, or bylargeStepwithShift.HomeandEndsend it to the ends, andEnterfolds the pane and unfolds it. - The horizontal arrows flip on a right-to-left page.
API reference
| Prop | Type | Default |
|---|---|---|
orientation | 'horizontal' | 'vertical' Across its parent, or as tall as its row. | 'horizontal' |
decorative | boolean A line to see only, which a screen reader skips. A separator with a | false |
value | number Makes it a splitter: the size of the pane before it, between | — |
min | number The value with the pane folded. | 0 |
max | number The value with the pane at its largest. | 100 |
step | number The move of one arrow key. | 1 |
largeStep | number The move of one arrow key with | 10 |
onValueChange | (value: number) => void Called with the value after each move. | — |
aria-controls | string The id of the pane the splitter sizes. | — |
disabled | boolean Holds the splitter still. It stays a tab stop, and says it is disabled. | false |
element | HTMLDivElement | null The rendered element. Bindable. | — |
Plus every attribute of a <div>, but the role and the ARIA values it sets.