Skip to content

Slider for Angular

AngularInputs

Picks a number, or a range with two thumbs, from a bounded scale such as volume, a price range, or working hours. Each thumb is a WAI-ARIA slider; range thumbs limit each other. Keyboard by step, large step, and ends; pointer press and drag. A Form control with hidden inputs for native submission.

  • Single or rangeOne thumb for a value, two thumbs for a range that limit each other.
  • Marks and stepsTick marks, labelled marks, step and large step for keyboard and pointer.
  • Formatted valuesIntl number formats or your own text for the value and screen readers.
  • Form readyHidden inputs submit natively; validation and custom errors like every field.

Behavior, design tokens, and limitations are described on the Slider page; this page covers the Angular API.

import { Component } from '@angular/core';
import type { SliderValue } from '@absoluteui/components/slider';
import { AuiSlider } from '@absoluteui/angular/slider';
@Component({
selector: 'app-price-filter',
imports: [AuiSlider],
template: `<aui-slider label="Price" [range]="true" [min]="0" [max]="500" [step]="10" [format]="eur" [(value)]="price"></aui-slider>`,
})
export class PriceFilterComponent {
price: SliderValue = [50, 300];
readonly eur: Intl.NumberFormatOptions = { style: 'currency', currency: 'EUR', maximumFractionDigits: 0 };
}
Terminal window
npm install @absoluteui/angular @absoluteui/components @absoluteui/core @absoluteui/theme

Setup with provideAbsoluteUI() is covered in Getting started. Styles are included with the component.

import { AuiSlider } from '@absoluteui/angular/slider';

Defaults for every instance: provideAbsoluteUIConfig({ components: { slider: { ... } } }) (see Configuration).

Class AuiSlider; template reference #ref="auiSlider".

Server rendering: Renders on the server; the browser re-creates it after hydration.

Angular forms: implements ControlValueAccessor and Validator; the form value is SliderValue. Bind [formControl], formControlName, or [(ngModel)]; validation messages of the component report through the aui error key. See Forms.

Input Type Default Description
label string Required. Visible label; names the thumbs.
hideLabel boolean false Visually hide the label.
description string Help text, referenced by the thumbs.
min number '0' Lower bound.
max number '100' Upper bound (greater than min).
step number '1' Values snap to min + n * step.
largeStep number Page Up/Page Down step (default: a tenth of the scale in whole steps).
range boolean false Two thumbs selecting [start, end].
orientation "horizontal" | "vertical" 'horizontal' Layout and key mapping.
marks boolean | readonly SliderMark[] true: a tick per step (up to 100); or explicit { value, label? } marks.
format NumberFormatOptions Number format of the value text.
valueText (value: number) => string Full value text (overrides format).
disabled boolean false Disable the slider.
name string Form field name (hidden inputs; a range submits two values).
showValue boolean true Show the value next to the label.
locale string 'en-US' Locale of the value text and thumb names.
Model Type Change output Description
[(value)] SliderValue (valueChange) The value: [(value)] without forms; with Angular forms, bind the form control instead.
Output Payload Description
(valueInput) SliderValueDetail The value changes while dragging or with a key: { value }. Re-emits aui-input.
(changed) SliderValueDetail The value was committed (pointer release or a key): { value }. Re-emits aui-change.

Call them through a viewChild query or a template reference.

Method Description
setCustomError(message: string | null): void Show or clear an external error.
focus(): void Focus the (first) thumb.
reset(): void Restore the initial value and clear the error.

Pattern: WAI-ARIA APG Slider and Multi-Thumb Slider: each thumb is role=slider with aria-valuenow, aria-valuemin, aria-valuemax, and aria-valuetext.

The Angular component renders the framework-neutral component, so its keyboard support, roles, WCAG 2.2 criteria, budgets, and import cost apply unchanged: see Slider: Accessibility and performance.