BrowseSegmented Control

Controls

Glass Segmented Control

A row of choices with a glass lozenge you can tap or drag between them.

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 { GlassSegmentedControl, GlassSegmentedControlItem } from 'ngx-vitreo';

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

Usage

Usage

<glass-segmented-control
  aria-label="View"
  class="cpreview-segmented"
  [(value)]="view"
  (valueChange)="announce($event)"
>
  @for (option of views; track option) {
    <button glassSegmentedControlItem [value]="option">{{ option }}</button>
  }
</glass-segmented-control>

API reference

GlassSegmentedControl

<glass-segmented-control>

InputTypeDefaultDescription
[(value)]stringNoneThe selected option. (valueChange) emits the value of the newly selected option.
contentbutton[glassSegmentedControlItem]NoneTwo to six items placed directly inside the control, which CSS counts to place the selection before scripts run.
ngModel / formControlControlValueAccessorNoneBinds the value to a template-driven or reactive form, including disabled state.

GlassSegmentedControlItem

button[glassSegmentedControlItem]

InputTypeDefaultDescription
valuestringNoneThe value this option selects. Required.
disabledbooleanfalseSkips the option and keeps it from being chosen.