XiodUI
HomeDocs
OverviewComponentsStyling & CustomizationChangelog

Components

  • Accordion
  • Agent Steps
  • Alert
  • Alert Dialog
  • Aspect Ratio
  • Autocomplete
  • Avatar
  • Badge
  • Breadcrumb
  • Button
  • Button Group
  • Button Split
  • Calendar
  • Card
  • Carousel
  • Checkbox
  • Circular Progress
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy To Clipboard
  • Corner Badge
  • Dashboard Grid
  • Date Picker
  • Dialog
  • Dot Matrix
  • Draggable
    Updated
  • Drawer
  • Empty
  • Field
  • Fieldset
  • File Upload
    Updated
  • Form
  • Frame
  • Gauge
  • Grid
  • Group
  • Input
  • Input Group
  • Input OTP
  • Input Payment
  • Input Phone
    Updated
  • Input Sensitive
  • Kbd
  • Kinetic Click
  • Label
  • List Box
    Updated
  • Loader
  • Marker
  • Menu
  • Menubar
  • Message
  • Meter
  • Morphic Toast
  • Navigation Menu
  • Number Field
  • Option Picker
  • Orb
  • Pagination
  • Popover
  • Preview Card
    Updated
  • Progress
  • Radio
  • Resizable
  • Ruler Picker
  • Scroll Area
  • Scroll Bar
  • Select
  • Separator
  • Sidebar
  • Skeleton
  • Slider
  • Sortable
  • Switch
  • Table
  • Tabs
  • Text
  • Textarea
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Toolbar
  • Tooltip
  • Waveform
  • Wheel Picker

Loading...

Preview Skeleton

Installation Skeleton

Usage Skeleton

API Reference Skeleton

Sponsors

Support the development of XiodUI and help us build the best component library on Earth.

+++
Sponsor on GitHub

Slider

Previous: SkeletonNext: Sortable

A control for picking a value or range by dragging a thumb along a track.

Preview

Loading Preview...

Installation

bun add xiod-ui

Usage

Imports

1import { Slider, SliderValue } from "xiod-ui/slider";

API Reference

Detailed documentation of properties and options.

Slider

Accepts className, style and render, plus every native attribute of the element it renders.

PropTypeDefaultDescription
defaultValue
number | readonly number[]
–

The uncontrolled value of the slider when it's initially rendered.

To render a controlled slider, use the value prop instead.

SkeletonSortable
disabled
boolean
false

Whether the slider should ignore user interaction.

form
string
–

Identifies the form that owns the slider inputs. Useful when the slider is rendered outside the form.

format
NumberFormatOptions
–

Options to format the value.

getAriaLabel
((index: number) => string) | null
–

Returns the name of the thumb at an index. Give one to a range slider, so each thumb has its own name. A single-thumb slider takes its name from aria-label when this isn't set.

getAriaValueText
((formattedValue: string, value: number, index: number) => string) | null
–

Returns the text a screen reader reads for a thumb's value, for example "5 to 10 GB".

indicatorClassName
string
–

Classes for the filled part of the track.

largeStep
number
10

The granularity with which the slider can step through values when using Page Up/Page Down or Shift + Arrow Up/Arrow Down.

locale
LocalesArgument
–

The locale used by Intl.NumberFormat when formatting the value. Defaults to the user's runtime locale.

max
number
100

The maximum allowed value of the slider. Should not be equal to min.

min
number
0

The minimum allowed value of the slider. Should not be equal to max.

minStepsBetweenValues
number
0

The minimum steps between values in a range slider.

name
string
–

Identifies the field when a form is submitted.

onValueChange
((value: number | readonly number[], eventDetails: SliderRootChangeEventDetails) => void)
–

Callback function that is fired when the slider's value changed. Receives the new value as the first argument; the originating event is available as eventDetails.event. The value is also reflected on eventDetails.event.target.value for form integration.

The eventDetails.reason indicates what triggered the change:

  • 'input-change' when the hidden range input emits a change event (for example, via form integration)
  • 'track-press' when the control track is pressed
  • 'drag' while dragging a thumb
  • 'keyboard' for keyboard input
  • 'none' when the change is triggered without a specific interaction
onValueCommitted
((value: number | readonly number[], eventDetails: SliderRootCommitEventDetails) => void)
–

Callback function that is fired when a value change is committed. Does not fire if the value did not change, or if the change was canceled. **Warning**: This is a generic event, not a change event.

The eventDetails.reason indicates what triggered the commit:

  • 'drag' while dragging a thumb
  • 'track-press' when the control track is pressed
  • 'keyboard' for keyboard input
  • 'input-change' when the hidden range input emits a change event (for example, via form integration)
  • 'none' when the commit occurs without a specific interaction
orientation
"horizontal"|"vertical"
'horizontal'

The component orientation.

step
number
1

The granularity with which the slider can step through values. (A "discrete" slider.) The min prop serves as the origin for the valid values. We recommend (max - min) to be evenly divisible by the step.

thumbAlignment
"center"|"edge"|"edge-client-only"
'center'

How the thumb(s) are aligned relative to Slider.Control when the value is at min or max:

  • center: The center of the thumb is aligned with the control edge
  • edge: The thumb is inset within the control such that its edge is aligned with the control edge
  • edge-client-only: Same as edge but renders after React hydration on the client, reducing bundle size in return
thumbClassName
string
–

Classes for every thumb.

thumbCollisionBehavior
"none"|"push"|"swap"
'push'

Controls how thumbs behave when they collide during pointer interactions.

  • 'push' (default): Thumbs push each other without restoring their previous positions when dragged back.
  • 'swap': Thumbs swap places when dragged past each other.
  • 'none': Thumbs cannot move past each other; excess movement is ignored.
trackClassName
string
–

Classes for the track.

value
number | readonly number[]
–

The value of the slider. For range sliders, provide an array with one value per thumb.

variant
"default"|"expressive"|"classic"|"dotted"|"fader"|"segmented"
default

The visual style of the component.

SliderValue

Accepts className, style and render, plus every native attribute of the element it renders.

PropTypeDefaultDescription
children
((formattedValues: readonly string[], values: readonly number[]) => ReactNode) | null
–

The content of the component.