Slider
vig-slider
import { Slider } from '@vigdx/ui/slider';Basic
[(value)] to a number | null signal and set min , max (default 0 and 100) and step . showValue prints the current value next to the label. The filled part of the track follows the reading direction.
Volume: 40 · Team: 6
Value template
valueTemplate formats the shown value and aria-valuetext ; {0} is replaced by the number formatted for the active locale, so units and decimals read correctly.
Ticks
[ticks]="true" draws a mark per step (up to 50 steps). An array of values draws labelled marks at those values instead. Ticks are visual only.
Empty, hidden label, disabled, read-only and error
null ) rests at min until moved. hideLabel keeps the label for screen readers only. readonly keeps the thumb focusable but ignores changes. Errors show once the slider is touched and invalid .
Rests at the minimum until moved.
Label hidden, still announced.
Reactive Forms
VigValueAccessor next to the component to use formControlName , [formControl] or ngModel .
Signal Forms
vig-slider implements FormValueControl<number | null> . Schema min() and max() rules bind to the slider's range; other rules, such as this validate() , show their message once the slider is touched.
50 to 500 €, in steps of 20 €.
Valid: yes · 120
Styling hooks
Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="slider"][data-part="header"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.
Scope: [data-scope="slider"]
| Part | Element | data-state |
|---|---|---|
header | — | |
label | <label> . | — |
value | showValue ). | — |
input | — | |
ticks | ticks ). | — |
tick | — | |
hint | vig-hint (a display: contents host; style its text part). | — |
disabled-reason | vig-hint with the disabled reason ( display: contents ). | — |
error | vig-field-error (a display: contents host; style its message part). | — |
Accessibility
- A native
<input type="range">, exposed as a slider: the arrows change the value bystep, Page Up and Page Down by larger steps, Home and End jump tominandmax. - It is named by a real
<label for>, also withhideLabel. The printed value is hidden from screen readers because it is already announced througharia-valuetext. - Use
valueTemplateto add units, so "15 %" is announced rather than "15". readonlyand an invalid state setaria-readonlyandaria-invalid. The slider role does not supportaria-required, sorequiredadds a visually hidden "Required" (requiredLabel) to the description; hint and error are linked througharia-describedbytoo.- The track is a light
--color-mutedbar inside a--color-border-controlborder: the border is at least 3:1 against the page like other control boundaries, and the fill at least 3:1 against the track. Forced-colors mode draws both with system colors. - Sliders are hard to set precisely on touch screens; for exact numbers offer a number input instead or next to it.
API
Slider
vig-sliderRange slider built on the native <input type="range">, so keyboard
(arrows, Page Up/Down, Home/End) and assistive-tech support come from the
browser. Styled entirely with tokens: track --color-muted inside a
--color-border-control border, fill
--color-primary, thumb --color-background with a primary border.
Empty is null; an empty slider rests at min until moved.
| Name | Type | Default | Description |
|---|---|---|---|
dirty | boolean | false | — |
disabled | boolean | false | — |
disabledReasons | readonly WithOptionalFieldTree<DisabledReason>[] | [] | — |
errorMessages | Record<string, string> | — | — |
errors | readonly ValidationError.WithOptionalFieldTree[] | [] | — |
hidden | boolean | false | — |
hideLabel | boolean | false | Keeps the label for assistive tech only. |
hint | string | undefined | undefined | — |
invalid | boolean | false | — |
label | string | — | — |
max | number | undefined | 100 | — |
min | number | undefined | 0 | — |
name | string | '' | — |
pending | boolean | false | — |
readonly | boolean | false | — |
required | boolean | false | — |
requiredLabel | string | undefined | undefined | Screen-reader text conveying |
showValue | boolean | false | Shows the formatted value beside the label. |
step | number | 1 | — |
ticks | boolean | readonly number[] | false | Tick marks under the track: |
touched | boolean | false | — |
value | number | null | null | — |
valueTemplate | string | ((value: number) => string) | '{0}' | Formats the value for display, |
| Name | Payload | Description |
|---|---|---|
touch | void | — |
valueChange | number | null | — |
| Signature | Description |
|---|---|
focus(options?: FocusOptions): void | Moves focus to the control's interactive element (the input, or the
trigger of a popup control). Signal Forms calls it through
|
reset(): void | Returns the control to its pristine look: drops in-progress text, closes
an open popup, clears errors the component raised itself and the
submitted state of |
VigValueAccessor
Bridges the vigdx form fields to Reactive Forms (formControl,
formControlName) and template-driven forms (ngModel). Import it next to
the component; Signal Forms ([formField]) need no accessor.
| Signature | Description |
|---|---|
registerOnChange(fn: (value: unknown) => void): void | — |
registerOnTouched(fn: () => void): void | — |
setDisabledState(disabled: boolean): void | — |
writeValue(value: unknown): void | — |