Skip to content

Slider

Props ​

PropertyTypeDefaultDescription
v-modelnumber | [number, number]—Required. A single value or a range.
labelstring—Required. The slider name.
idstring—Association ID prefix. Generated when omitted.
minnumber0Minimum value.
maxnumber100Maximum value.
stepnumber1Increment per step. Must be greater than 0.
minStepsBetweenThumbsnumber0Minimum number of steps between range thumbs.
orientation'horizontal' | 'vertical'horizontalSlider orientation.
valueDisplay'tooltip' | 'text' | 'none'tooltipHow to display values.
formatValue(value: number) => string—Formats display values and accessible value text.
marksSliderMark[]—Marks. Each has a value and optional label.
descriptionstring—Description below the label.
isLabelHiddenbooleanfalseHides the visual label. Preserves its accessible name.
isDisabledbooleanfalsePrevents changes. Excludes form values.
disabledMessagestring—Disabled reason. Keeps disabled thumbs focusable.
isRequiredbooleanfalseShows the required marker. Does not run native required validation.
isOptionalbooleanfalseShows the optional marker. Overrides isRequired.
requiredLabelstringRequiredRequired marker text.
optionalLabelstringOptionalOptional marker text.
minLabelstringMinimum valueAccessible name for the lower thumb.
maxLabelstringMaximum valueAccessible name for the upper thumb.
widthnumber | string—Field width. Numbers use pixels.
htmlNamestring—Name for hidden form values.
formstring—ID of the associated form.
statusFieldStatusInput—Error, warning or success status.
labelIconComponent—Decorative label icon.
labelTooltipstring—Information tooltip beside the label.

Events ​

  • update:modelValue(value): updates a number or range.
  • change(value): fires when the value changes.
  • changeEnd(value): fires after a drag, pointer cancellation or keyboard adjustment.

Each supported key press fires changeEnd. An unchanged value at a boundary does not fire change. Disabling the component during a drag cancels that drag. This cancellation does not fire changeEnd.

Ranges and steps ​

  • Use a number for single-value mode.
  • Use [number, number] for range mode.
  • Steps are relative to min.
  • Minimum separation is minStepsBetweenThumbs × step.
  • Thumbs cannot cross.
  • Values outside the bounds display at the nearest bound.
  • Input ranges display in ascending order.
  • Display normalization does not update the bound model by itself.
  • Non-positive steps use 1.
  • If max is below min, the interval collapses to min.

Forms ​

  • Set htmlName to submit one hidden field for a single value.
  • Ranges submit two hidden fields with the same name.
  • Read ranges with FormData.getAll(name).
  • Disabled sliders do not submit values.
  • Native form reset does not change v-model.
  • Update the bound value in the form's reset handler to reset it.

Template references and attributes ​

  • element: the control's HTMLDivElement | null.
  • focus(index = 0, options?): focuses the specified thumb.
  • blur(): removes thumb focus.
  • class, style and other attributes apply to the outer field.
  • aria-labelledby and aria-describedby merge into each thumb.
  • The component owns thumb roles, values, bounds and disabled states.
  • The labelIcon slot replaces the label icon.

Theme ​

css
.my-slider {
  --astryx-slider-accent: #047857;
  --astryx-slider-focus: #047857;
  --astryx-slider-height: 200px;
}
  • --astryx-slider-track: unfilled track color.
  • --astryx-slider-accent: filled track and thumb color.
  • --astryx-slider-focus: keyboard focus color.
  • --astryx-slider-height: vertical control height.

Thumb diameter is fixed at 20px. Track thickness is 4px. Neutral follows the active light or dark mode.