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/domImport
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>
| Input | Type | Default | Description |
|---|---|---|---|
[(value)] | string | None | The selected option. (valueChange) emits the value of the newly selected option. |
content | button[glassSegmentedControlItem] | None | Two to six items placed directly inside the control, which CSS counts to place the selection before scripts run. |
ngModel / formControl | ControlValueAccessor | None | Binds the value to a template-driven or reactive form, including disabled state. |
GlassSegmentedControlItem
button[glassSegmentedControlItem]
| Input | Type | Default | Description |
|---|---|---|---|
value | string | None | The value this option selects. Required. |
disabled | boolean | false | Skips the option and keeps it from being chosen. |