A numeric setting in one row
The whole bar is the slider. Its fill is the value, the name sits inside on the left and the reading on the right, so a setting costs one row with no label above it. Drag anywhere on the bar, click to jump, or use the arrow keys: a native range input covers the bar, so pointer, keyboard and screen-reader behaviour are the platform’s.
Sizes
The size prop matches Button’s, so a bar and a button of one size sit level in the same rail. Default is 40px tall and compact is 32px.
Reading
Without format, the reading shows the step’s precision, so a step of 0.02 reads “0.50”. With it, the formatted string is both the visible reading and the value a screen reader announces.
Disabled
When to use it
Use the inspector slider in a dense panel of many settings, such as a tool’s side rail, usually inside an inspector section. In a form, where a label above and helper text below earn their room, use Slider instead.
Props
Read from the same JSDoc that ships in the package's types. A required prop is marked with an asterisk.
| Prop | Type | Default | Description |
|---|---|---|---|
label* | string | The setting's name, drawn inside the bar on the left. Also the range's accessible name. | |
value | number | Current value (controlled). Leave unset and use `defaultValue` for an uncontrolled slider. | |
defaultValue | number | Starting value for an uncontrolled slider. Defaults to `min`. | |
min | number | 0 | Minimum value. |
max | number | 100 | Maximum value. |
step | number | 1 | Step increment. Also sets how many decimals the reading shows (0.02 reads "0.50"). |
format | ((value: number) => string) | Formats the reading on the right, and the value a screen reader announces. Defaults to the step's precision. | |
size | "default" | "compact" | 'default' | Component size, matching Button: `default` is 40px tall, `compact` 32px (not the native character-width `size` attribute). |
onValueChange | ((value: number) => void) | Convenience callback receiving the numeric value directly.
Fires alongside `onChange`, which keeps the standard React event signature. | |
locale | string | The BCP 47 locale the reading is written in when no `format` is given, such as `de-DE` (`0,5`). Defaults to the nearest LocaleProvider's, else `en-US`. | |
className | string | '' | Additional CSS classes, applied to the bar rather than the <input>. |
Keys
A native range input: the browser’s own arrow, Home, End and Page keys move it. Those keys belong to the platform, so no test of this library presses them.
// From the npm package
import { InspectorSlider } from 'rift-ds/components/InspectorSlider/InspectorSlider';
// Or as source you own, via the shadcn CLI
npx shadcn@latest add https://rift-ds.com/r/inspector-slider.json1.0 kB gzipped, with everything it imports. Peer dependencies are not counted.
For agents: the props, their allowed values and defaults, and the tested keys, as markdown or as a JSON schema.