Skip to content

Slider

Adjust one quantized numeric value with pointer or keyboard input.

Usage

Single value

Choose one horizontal value with pointer or keyboard input.

Deployment trafficPercentage of users receiving the new release40%
0% · Current50% · Gradual100% · Everyone

Vertical value

Choose one vertical value with pointer or keyboard input.

Deployment trafficPercentage of users receiving the new release40%
0% · Current50% · Gradual100% · Everyone

Controlled value

Let the parent own the slider value while pointer and keyboard input emit requests.

Deployment trafficPercentage of users receiving the new release40%
0% · Current50% · Gradual100% · Everyone

API

Vue package: @sectile/vue/slider

Components
  • SliderRoot
  • SliderTrack
  • SliderRange
  • SliderThumb

Props

SliderRootProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

defaultValue

Initial value used when the component owns its state.

disabled

Whether interaction is unavailable.

form

ID of the native form associated with the control.

formatValue

Formats a value for visible text.

label

Accessible name announced for the control.

max

Largest value accepted by the component.

min

Smallest value accepted by the component.

modelValue

Current value when state is controlled by the parent.

name

Name used for native form submission.

orientation

Axis used for layout and keyboard movement.

pageStep

Larger increment used by Page Up and Page Down.

readonly

Whether the value can be inspected but not changed.

required

Whether the control must contain a valid value before submission.

role

ARIA role applied to the rendered control.

step

Smallest value increment accepted by the component.

SliderPartProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

Slots

SliderSlotProps

disabled

Whether interaction is unavailable.

percentage

Current value expressed as a percentage of its range.

readonly

Whether the value can be inspected but not changed.

value

Current value exposed by this contract.

Events

SliderRoot

update:modelValue

Emitted when the component requests a new controlled value.

Other types

SliderValueFormatter

ts
type SliderValueFormatter = NonNullable<SliderRootProps['formatValue']>

SliderValueChangeHandler

ts
type SliderValueChangeHandler = (value: string) => void

Parts

Shared scope: [data-scope="slider"]. Combine it with a part selector to keep styles local to this component.

PartSelectorRoleExtra attributes
root[data-part="root"]Defines the component boundary and owns its composed parts.
track[data-part="track"]Defines the measurable path used by one or more thumbs.
range[data-part="range"]Shows the active interval on the track.
thumb[data-part="thumb"]Controls one value along the track.

Keyboard interaction

KeyBehavior
Arrow Right / Arrow UpIncrease the value by one step.
Arrow Left / Arrow DownDecrease the value by one step.
Home / EndMove to the minimum or maximum value.
Page Up / Page DownChange the value by the configured page step when supported.

Accessibility

The thumb exposes its accessible name, minimum, maximum, current value, orientation, and interaction state.

See the corresponding WAI-ARIA pattern for the host accessibility contract.

Released under the MIT License.