# Slider

A value along a track, tuned by feel: a level, or a size with its track widening and its ink on the thumb.

Live variants: https://design.arcadia.is/components/slider

```tsx
import { Slider } from "@arcadia/ui";
```

Drag the volume or fine-tune it with the arrow keys.

```tsx
import { useState } from "react";
import { Slider } from "@arcadia/ui";

function Volume() {
  const [value, setValue] = useState(40);
  return (
    <div {...sx("cmp-slider-row", SliderStyles.row)}>
      <Slider label="Volume" value={value} onValueChange={setValue} valueText={(v) => `${v} percent`} rootStyle={SliderStyles.stretch} />
      <span {...sx("cmp-slider-value", SliderStyles.value)} aria-hidden="true">{value}%</span>
    </div>
  );
}
```

## Accessibility

A `slider` named by its required `label`, with its value, its bounds and its orientation; `valueText` gives the value in words. Its hit area is a control's full height, whatever the thin track. Up and Right raise it, in either direction of writing. Under forced colours, which drop every fill, the track is drawn in the system's ink and the thumb in its highlight. On touch a swipe across its travel scrolls the page, up and down past a level slider and sideways past an upright one; a drag along it moves the value.

- Arrow keys: One step
- Page Up, Page Down: A tenth of its range
- Home, End: Its least and its most

## API reference

### Slider

- `label` (`string`, required)
- `value` (`number`)
- `defaultValue` (`number`)
- `onValueChange` (`(value: number) => void`)
- `onActiveChange` (`(active: boolean) => void`)
- `min` (`number`, default `0`)
- `max` (`number`, default `100`)
- `step` (`number`, default `1`)
- `orientation` (`"horizontal" | "vertical"`, default `"horizontal"`)
- `scale` (`"linear" | "root" | number`, default `"linear"`)
- `taper` (`boolean`, default `false`)
- `ink` (``#${string}``)
- `valueText` (`(value: number) => string`)
- `disabled` (`boolean`, default `false`)
- `stops` (`readonly number[]`)
- `rootStyle` (`RootStyle<SliderKnobs>`)

Rest props go to `<div>` props.
