BrowseSlider

Controls

Glass Slider

Drag along a glass track to set a value or a range.

Preview

Installation

Install the package once, then import the parts you use into a standalone component.

Install

npm install ngx-vitreo @angular/cdk @floating-ui/dom
Import

import { GlassSlider } from 'ngx-vitreo';

@Component({
  imports: [GlassSlider],
  // ...
})

Usage

Usage

<div class="cpreview-slider">
  <svg aria-hidden="true" class="site-glyph site-glyph--small" fill="currentColor" viewBox="0 0 24 24">
    <path d="M3.5 9.2h3.3L11.4 5a.8.8 0 0 1 1.3.6v12.8a.8.8 0 0 1-1.3.6l-4.6-4.2H3.5a1 1 0 0 1-1-1V10.2a1 1 0 0 1 1-1Z" />
    <path d="M15.6 8.6a4.8 4.8 0 0 1 0 6.8" fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.9" />
  </svg>
  <glass-slider
    aria-label="Volume"
    class="cpreview-slider-control"
    [max]="100"
    [(value)]="volume"
    (valueCommit)="announce($event)"
  />
  <svg aria-hidden="true" class="site-glyph" fill="currentColor" viewBox="0 0 24 24">
    <path d="M3.5 9.2h3.3L11.4 5a.8.8 0 0 1 1.3.6v12.8a.8.8 0 0 1-1.3.6l-4.6-4.2H3.5a1 1 0 0 1-1-1V10.2a1 1 0 0 1 1-1Z" />
    <path d="M15.6 8.6a4.8 4.8 0 0 1 0 6.8M18.6 5.6a9 9 0 0 1 0 12.8" fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.9" />
  </svg>
</div>

API reference

GlassSlider

<glass-slider>

InputTypeDefaultDescription
[(value)] / defaultValuenumber[][min]The values; the array length sets the number of thumbs. (valueChange) emits on every change while dragging or stepping.
(valueCommit)number[]NoneEmits when a drag ends or a key changes the value.
min / max / stepnumber0 / 100 / 1Range and increment of the values.
orientation / inverted'horizontal' | 'vertical' / boolean'horizontal' / falseDirection the track runs and fills.
aria-labelstringNoneMoved to the thumbs: a single thumb takes it as is; range thumbs get it with ', minimum', ', maximum' or ', 2 of 3' added.
thumbLabelsstring[]NoneNames each thumb in value order, replacing the names built from aria-label.
ngModel / formControlControlValueAccessorNoneBinds a form value; a form that writes a single number gets numbers back, otherwise arrays.