base-ui-svelte

Slider

An input where the user selects a value from a range.

View as Markdown
Volume 40

API Reference

Props mirror Base UI React where applicable, adapted for Svelte 5. Native HTML attributes for the rendered element are also accepted unless noted.

Slider.Root

Extends div HTML attributes.

PropertyTypeDefaultDescription
valueSliderValue | undefinedControlled value.
defaultValueSliderValueUncontrolled initial value.
minnumber
maxnumber
stepnumber
disabledbooleanfalseWhether the control ignores user interaction.
orientationSliderOrientation'horizontal'
namestring | undefined
formatIntl.NumberFormatOptions | undefined
localeIntl.LocalesArgument | undefined
onValueChange((value: SliderValue, event: Event) => void) | undefinedEvent handler called when the value changes.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-disabledPresent when the part is disabled.
data-orientationThe orientation of the component.

Slider.Control

Extends div HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-disabledPresent when the part is disabled.
data-orientationThe orientation of the component.

Slider.Indicator

Extends div HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-disabledPresent when the part is disabled.
data-orientationThe orientation of the component.

Slider.Label

Extends span HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-disabledPresent when the part is disabled.

Slider.Thumb

Extends span HTML attributes.

PropertyTypeDefaultDescription
indexnumber | undefinedIndex into the value array for range sliders (recommended for SSR).
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-disabledPresent when the part is disabled.
data-indexIndex of the item within a collection.
data-orientationThe orientation of the component.

Slider.Track

Extends div HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-disabledPresent when the part is disabled.
data-orientationThe orientation of the component.

Slider.Value

Extends span HTML attributes.

PropertyTypeDefaultDescription
childrenSnippet<[formattedValue: string, value: SliderValue]>Content rendered inside the part.
Data attributeDescription
data-disabledPresent when the part is disabled.