Search documentation

Search the documentation and open a page.

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

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/slider

Composition

<app-slider> ├── [appSliderLabel] (optional) ├── [appSliderControl] │ ├── [appSliderTrack] │ │ └── [appSliderRange] │ └── [appSliderThumb] │ ├── <input appSliderHiddenInput> (optional) │ └── [appSliderDraggingIndicator] (optional) ├── [appSliderMarkerGroup] (optional) │ └── [appSliderMarker] └── [appSliderValueText] (optional)

Examples

Autoscaling

Loading...

Color

Loading...

Default

Loading...

Disabled

Loading...

Inline

Loading...

Range

Loading...

Scrubber

Loading...

Vertical

Loading...

API Reference

<app-slider>

Inputs

InputTypeDefaultDescription
idstring | undefinedgeneratedUnique identifier used to create the slider part IDs.
idsSliderElementIds | undefined—Overrides the generated IDs for individual parts.
aria-labelstring[] | undefined—Accessible label for each thumb, in thumb order.
aria-labelledbystring[] | undefined—ID reference providing an accessible label for each thumb.
valuenumber[] | undefined—Values when controlled. Supports Angular two-way binding.
defaultValuenumber[] | undefined[min]Initial values when uncontrolled.
disabledbooleanfalseDisables interaction with the slider.
readOnlybooleanfalsePrevents changes while preserving focus and navigation.
invalidbooleanfalseMarks the slider as invalid.
namestring | undefined—Name used when submitting the value with a form.
formstring | undefined—Associates the slider with a form by ID.
minnumber | undefined0Minimum allowed value.
maxnumber | undefined100Maximum allowed value.
stepnumber | undefined1Smallest permitted value increment.
largeStepnumber | undefined10 × stepIncrement used by Page Up and Page Down.
minStepsBetweenThumbsnumber | undefined0Minimum number of steps allowed between adjacent thumbs.
orientation"horizontal" | "vertical" | undefined"horizontal"Sets the layout and keyboard navigation axis.
origin"start" | "center" | "end" | undefined"start"Point from which the filled range is drawn.
thumbAlignmentSliderThumbAlignment | undefined"contain"Aligns thumbs inside or around the track bounds.
thumbSize{ width: number; height: number } | undefined—Explicit thumb dimensions used for layout calculations.
thumbCollisionBehaviorSliderThumbCollisionBehavior | undefined"none"Determines how thumbs behave when they meet.
getAriaValueText((details: SliderValueTextDetails) => string) | undefined—Returns accessible text for a thumb value.

Outputs

OutputTypeDescription
valueChangenumber[] | undefinedEmits the current slider values.
valueDetailsChangeSliderValueChangeDetailsEmits details whenever the values change.
valueChangeEndSliderValueChangeDetailsEmits when pointer or keyboard adjustment ends.
focusChangeSliderFocusChangeDetailsEmits when the focused thumb changes.

[appSliderThumb]

Inputs

InputTypeDefaultDescription
indexnumberrequiredIndex of the value controlled by this thumb.
namestring | undefined—Form name used by this thumb's hidden input.

[appSliderMarker]

Inputs

InputTypeDefaultDescription
valuenumberrequiredValue represented by this position marker.

Context, Providers, and Utilities

ExportAngular API
SliderRootProviderDirective that provides an externally created slider API through value.
SliderContextStructural directive [slider-context] exposing the root API to a template.
useSlider(options)Creates the signal-backed slider machine inside an injection context.
injectSliderContext()Injects the nearest slider root context.
injectSliderThumbPropsContext()Injects the props context for the nearest thumb.
SliderImportsReadonly collection containing the slider UI and context helpers.

Types

ExportDescription
SliderApiConnected slider state and actions.
SliderElementIdsOverrides for generated slider part IDs.
SliderThumbPropsProps used to identify a slider thumb.
SliderMarkerPropsProps used to position a slider marker.
SliderDraggingIndicatorPropsProps used by a dragging indicator.
SliderThumbAlignmentSupported thumb alignment modes.
SliderThumbCollisionBehaviorSupported behavior when slider thumbs collide.
SliderValueTextDetailsDetails passed to getAriaValueText.
SliderValueChangeDetailsDetails emitted by value-change outputs.
SliderFocusChangeDetailsDetails emitted by focusChange.
SliderThumbPropsContextSignal-backed props for the nearest thumb.
UseSliderOptionsOptions accepted by useSlider.
UseSliderPropsRoot props accepted by the slider machine.
UseSliderReturnSignal-backed slider machine returned by useSlider.