` via rest props; `class` is merged onto the root.
Consumer layout CSS is required. For a horizontal split, use `display:flex` on `whole` and consume `--svs-splitter` with `flex-basis: var(--svs-splitter)` on the first pane.
`aria-orientation` is perpendicular to `orientation` because it describes the separator bar itself.
## Styling
To learn more, see [Styling](/docs/styling).
### Variant Management
No automatic switching.
### Default Class Name
`svs-splitter`
## Behavior
`orientation` drives the drag axis and arrow-key model: horizontal uses `clientX` / Left / Right, vertical uses `clientY` / Up / Down. The root emits a renameable first-pane size custom property (`--svs-splitter` by default, or `cssvar.position`) and exposes `data-orientation`; `data-dragging` is present only during an active pointer drag. Arrow keys move by `step`, Home moves to `min`, End moves to `max`, and keyboard movement clamps without snap. Pointer drag clamps and snaps to the nearest `snap` target within 3 percentage points. `aria-orientation` is perpendicular to layout orientation because it describes the separator bar itself: a left|right split has a vertical separator.
## Accessibility
### Keyboard Interactions
| Key | Description |
| --- | --- |
| `ArrowLeft` | When `orientation` is `"horizontal"`, decreases the first pane size by `step` |
| `ArrowRight` | When `orientation` is `"horizontal"`, increases the first pane size by `step` |
| `ArrowUp` | When `orientation` is `"vertical"`, decreases the first pane size by `step` |
| `ArrowDown` | When `orientation` is `"vertical"`, increases the first pane size by `step` |
| `Home` | Moves the separator to `min` |
| `End` | Moves the separator to `max` |
Keyboard movement clamps to `min` / `max` and does not apply `snap` targets.
### ARIA Roles and Attributes
The component applies these automatically:
- Separator (`main`): `role="separator"`, `tabindex="0"`, `aria-controls` (the first pane), `aria-orientation`, `aria-valuenow`, `aria-valuemin`, `aria-valuemax`, and `aria-label` from `label`.
Provide an accessible name for the separator yourself because there is no built-in visible label. Pass the `label` prop. The managed separator role and value attributes are component-owned and omitted from `SplitterProps`.
## Exports
### Types
```ts
type SplitterCssVar = "position";
interface SplitterProps extends Omit
, "children" | "role" | "style"> {
left: Snippet<[string]>; // Snippet<[variant]>
right: Snippet<[string]>; // Snippet<[variant]>
children?: Snippet<[number, string]>; // Snippet<[value,variant]>
orientation?: "horizontal" | "vertical"; // ("horizontal")
value?: number; // bindable (50)
min?: number; // (0)
max?: number; // (100)
step?: number; // (1)
snap?: number[]; // pointer-drag snap targets, within 3 percentage points
label?: string;
cssvar?: Partial>;
attach?: Attachment;
element?: HTMLDivElement; // bindable
styling?: SVSClass;
variant?: SVSVariant; // (VARIANT.NEUTRAL)
// class & other HTMLAttributes are passed to the root via ...rest (class is merged onto root)
// role and style are component-owned
}
type SplitterReqdProps = "left" | "right";
type SplitterBindProps = "value" | "element";
```
### Others
No additional exports are available.
## Examples
The example code uses Tailwind CSS along with `SVSClass`.
### Basic
**Code**
```svelte src=SplitterBasic.svelte
{#snippet left()}
Navigation
Drag the divider to resize this pane.
{/snippet}
{#snippet right()}
Content
The first pane consumes var(--svs-splitter).
{/snippet}
```
### With Interactive Variant
**Code**
```svelte src=SplitterPract.svelte
{#snippet left()}
Navigater
Drag the divider to resize this pane.
{/snippet}
{#snippet right()}
{#snippet left()}
Inspector
Snap targets are set at 30, 50, and 70.
{/snippet}
{#snippet right()}
Preview
Arrow keys move the separator by step.
{/snippet}
{/snippet}
```