Slider

Allows users to select a value from a continuous range by sliding a handle.

Structure

	<script lang="ts">
  import { Slider } from "bits-ui";
</script>
 
<Slider.Root>
  <Slider.Range />
  <Slider.Thumb />
  <Slider.Input />
</Slider.Root>
	
	<script lang="ts">
  import { Slider } from "bits-ui";
</script>
 
<Slider.Root>
  <Slider.Range />
  <Slider.Thumb />
  <Slider.Input />
</Slider.Root>
	

Component API

Slider.Root

The root slider component which contains the remaining slider components.

Property Type Description
value
number[]

The current value of the slider.

Default: []
onValueChange
function

A callback function called when the value state of the slider changes.

Default:  —— undefined
disabled
boolean

Whether or not the switch is disabled.

Default: false
max
number

The maximum value of the slider.

Default: 100
min
number

The minimum value of the slider.

Default: 0
orientation
enum

The orientation of the slider.

Default: "horizontal"
step
number

The step value of the slider.

Default: 1
asChild
boolean

Whether to use render delegation with this component or not.

Default: false
Slot Property Type Description
builder
object

The builder attributes and actions to apply to the element if using the asChild prop with delegation.

attrs
object

Additional attributes to apply to the element if using the asChild prop with delegation.

ticks
number

The number of ticks to display on the slider.

Data Attribute Value Description
data-orientation
enum

The orientation of the slider.

data-slider-root
——

Present on the root element.

Slider.Range

The range of the slider.

Property Type Description
asChild
boolean

Whether to use render delegation with this component or not.

Default: false
Slot Property Type Description
builder
object

The builder attributes and actions to apply to the element if using the asChild prop with delegation.

attrs
object

Additional attributes to apply to the element if using the asChild prop with delegation.

Data Attribute Value Description
data-slider-range
——

Present on the range elements.

Slider.Thumb

A thumb on the slider.

Property Type Description
asChild
boolean

Whether to use render delegation with this component or not.

Default: false
Slot Property Type Description
builder
object

The builder attributes and actions to apply to the element if using the asChild prop with delegation.

attrs
object

Additional attributes to apply to the element if using the asChild prop with delegation.

Data Attribute Value Description
data-slider-thumb
——

Present on the thumb elements.

Slider.Tick

A tick mark on the slider.

Property Type Description
asChild
boolean

Whether to use render delegation with this component or not.

Default: false
Slot Property Type Description
builder
object

The builder attributes and actions to apply to the element if using the asChild prop with delegation.

attrs
object

Additional attributes to apply to the element if using the asChild prop with delegation.

Data Attribute Value Description
data-bounded
——

Present when the tick is bounded.

data-slider-tick
——

Present on the tick elements.

🚧 UNDER CONSTRUCTION 🚧