# Field Slider

A slider drawn as a row of fine ticks with no track, the filled side in a soft gradient: the handle acts like a magnet, so nearby ticks lean toward it like iron filings and a drag sends a soft wave through the row.

- Page and source: https://uibrik.com/components/field-slider
- Install (Pro, needs a license key, see https://uibrik.com/docs/pro): `npx shadcn@latest add @uibrik-pro/field-slider`
- Packages: none beyond React
- Import: `import { FieldSlider } from "@/components/uibrik/field-slider/field-slider"`

Where to use the Field Slider React component:

- **Volume and audio**: The leaning ticks give a plain range input the feel of a physical control, with no extra chrome. Pairs with [Music Player](https://uibrik.com/components/music-player) and [Elastic Slider](https://uibrik.com/components/elastic-slider).
- **Settings panels**: A tick row sits quietly in a dense list of options and only comes alive where the user is pointing. Pairs with [Settings Page](https://uibrik.com/components/settings-page) and [Segmented Control](https://uibrik.com/components/segmented-control).
- **Editors and filters**: Intensity, opacity and blur controls read clearly as a scale, with the filled side showing the amount at a glance. Pairs with [Filter Bar](https://uibrik.com/components/filter-bar).

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| label | `string` | `"Volume"` | Shown above the ticks and used as the accessible name. |
| defaultValue | `number` | `40` | Starting value when uncontrolled. |
| step | `number` | `1` | Value increment. |
| ticks | `number` | `41` | Number of ticks across the row. |
| lean | `number` | `30` | Strongest lean, for the ticks right beside the handle. |
| reach | `number` | `4` | How far the pull reaches, in ticks. |
| showValue | `boolean` | `true` | Shows the value next to the label. |
| colors | `string[]` | `["#9cc7ff","#2f6bff"]` | Gradient across the filled ticks, from the start to the handle. Shades of one colour by default. |
| disabled | `boolean` | `false` |  |
| value | `number` |  | Controlled value. |
| onChange | `(value: number) => void` |  | Called as the value changes. |
| onCommit | `(value: number) => void` |  | Called once a drag or key press ends, with the final value. |
| min | `number` | `0` | Lowest value. |
| max | `number` | `100` | Highest value. |
| format | `(value: number) => string` |  | Formats the readout and the value read to screen readers, e.g. a percent or unit. |
| name | `string` |  | Form field name; adds a hidden input with the value. |
| className | `string` |  | Classes for the wrapper. It fills its container up to max-w-sm. |
