UnflowUI
Components

Slider

A single-value range slider with optional step dots, interval markers, and a focus tooltip, in horizontal or vertical layouts.

Overview

Slider wraps a native <input type="range"> with a styled track, thumb, focus tooltip, and optional step dots/markers. It's a controlled component — pass value and onChange to drive it, the same way you would a plain range input.

It supports a single numeric value (there's no dual-thumb/range-selection mode), a horizontal or vertical layout, and can render evenly-spaced interval markers either at a fixed spacing or auto-fitted to the available width.

Import

import { Slider } from '@unflow.io/ui/components/Slider';

Props

PropTypeDefaultDescription
namestringRequired. Name attribute for the underlying range input; also used to associate the label
valuenumber0Current value of the slider (controlled)
onChangeChangeEventHandler<HTMLInputElement>Called with the native change event whenever the range input value changes
labelstringField label rendered above the slider
hintstringHelper text rendered below the slider
min / maxnumber0 / 100Minimum and maximum allowed values
stepsnumber1Granularity of the native range input (the step attribute)
intervalnumbersame as stepsSpacing (in value units) between rendered step dots/markers
autoIntervalbooleanfalseComputes the marker interval automatically from the available track width instead of using a fixed interval
direction'horizontal' | 'vertical''horizontal'Layout axis of the slider
startLabel / endLabelstringText rendered before/after the track
startIcon / endIconReactNodeIcon rendered before/after the track
disableStepDotsbooleanfalseHides the small dots marking each step/interval on the track
disableStepMarkersbooleanfalseHides the numeric labels below (or beside) the track
disableTooltipbooleanfalseHides the value tooltip that appears above the thumb on focus
disabledbooleanDisables the input
requiredbooleanMarks the field as required
disableRequiredSymbolbooleanHides the "required" indicator next to the label
status / statusMessage'valid' | 'invalid' | 'error' / stringValidation state and accompanying message shown below the slider

Basic usage

const [value, setValue] = useState(25);

<Slider
  name="volume"
  label="Volume"
  value={value}
  onChange={(e) => setValue(Number(e.currentTarget.value))}
/>

Interval markers

Set steps/interval for fixed spacing, or autoInterval to let the slider fit as many markers as the available width allows.

const [value, setValue] = useState(40);

<Slider
  name="progress"
  label="Progress"
  value={value}
  onChange={(e) => setValue(Number(e.currentTarget.value))}
  steps={10}
  interval={20}
  autoInterval
/>

Vertical

const [value, setValue] = useState(60);

<Slider
  name="vertical-volume"
  label="Volume"
  direction="vertical"
  value={value}
  onChange={(e) => setValue(Number(e.currentTarget.value))}
  startLabel="Min"
  endLabel="Max"
/>

Disabled

<Slider name="disabled-slider" label="Volume" value={30} disabled />

Customization (slots & slotProps)

SlotTypeDescription
dot(dotProps: { offset: number; value: number; isInsideRange: boolean }) => ReactNodeRenders custom content inside each step dot
thumbReactNodeOverrides the default thumb content
Slot PropPropsDescription
rootBaseHTMLProps<HTMLDivElement>Outermost container (labels/icons + track)
startLabel / endLabelBaseHTMLProps<HTMLParagraphElement>Start/end label elements
inputRootBaseHTMLProps<HTMLDivElement>Wrapper around the input, track, thumb and tooltip
dotsRoot / dotBaseHTMLProps<HTMLDivElement> / BaseHTMLProps<HTMLSpanElement>Step dots container and each individual dot
markersRoot / markerBaseHTMLProps<HTMLDivElement>Interval markers container and each individual marker label
track / progressTrackBaseHTMLProps<HTMLSpanElement>The full track and the filled progress portion
thumbBaseHTMLProps<HTMLSpanElement>The draggable thumb element
tooltipBaseHTMLProps<HTMLSpanElement>The focus tooltip showing the current value

Accessibility

  • The native <input type="range"> carries the implicit slider role, so screen readers announce the label, current value, and min/max out of the box.
  • label/hint/status are wired through InputLabel, keeping the label associated with the input via id/name and exposing status messages.
  • The focus tooltip uses role="tooltip" and appears on keyboard focus, not just on drag, so keyboard users get the same value feedback as mouse users.
  • Step dots and interval markers are purely decorative (inert) and never receive focus or get announced.