Slider

A styled range input for selecting a numeric value within a defined range, with optional label, hint, and current value display.

Installation

npx dafink-ui add slider

Demo

Drag or use arrow keys to adjust.

Props

NameTypeDefaultDescription
valuenumber-Controlled current value.
onValueChange(value: number) => void-Called with the new numeric value on change.
minnumber0Minimum value.
maxnumber100Maximum value.
stepnumber1Increment between selectable values.
disabledbooleanfalseDisables the slider.
labelstring-Visible label above the track; links to the input via id.
hintstring-Helper text below the track.
showValuebooleanfalseShows the current numeric value next to the label.
size'default' | 'sm''default'"sm" renders a shorter row and thinner track for dense layouts.
tone'brand' | 'current''brand'"current" derives track/fill/thumb color from currentColor instead of the brand token, for sliders placed on an arbitrary colored surface (e.g. inside a colored chat bubble).
ariaLabelstring-Sets aria-label on the input directly; use when there is no visible label.
ariaValueTextstring-Overrides the announced value with a custom string, e.g. a formatted timestamp.
classNamestring""Additional classes merged onto the root wrapper.

Accessibility

Slider has no custom keyboard handling of its own — it's a single native input type="range", so all keyboard interaction comes from the browser's built-in range-input behavior. Tab reaches it as one stop; the component mirrors the resulting value visually (fill width, thumb focus ring) rather than intercepting or reimplementing any of it.

KeyFunction
right arrowIncreases the value by one step.
up arrowIncreases the value by one step.
left arrowDecreases the value by one step.
down arrowDecreases the value by one step.
homeJumps to the minimum value.
endJumps to the maximum value.
page upIncreases the value by a larger increment (native browser behavior).
page downDecreases the value by a larger increment (native browser behavior).