Controls
Glass Radio Group
A set of options where picking one clears the others.
Preview
For trying things out.
For teams shipping weekly.
For everything else.
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 { GlassRadioGroup, GlassRadioGroupItem } from 'ngx-vitreo';
@Component({
imports: [GlassRadioGroup, GlassRadioGroupItem],
// ...
})Usage
Usage
<glass-panel class="cpreview-choices" variant="card">
<glass-radio-group aria-label="Plan" [(value)]="plan" (valueChange)="announce($event)">
@for (item of plans; track item.value) {
<glass-radio-group-item
[description]="item.description"
[label]="item.label"
[value]="item.value"
/>
}
</glass-radio-group>
</glass-panel>API reference
GlassRadioGroup
<glass-radio-group>
| Input | Type | Default | Description |
|---|---|---|---|
[(value)] | string | None | The chosen option's value. (valueChange) emits when the user chooses one. |
orientation | 'horizontal' | 'vertical' | None | Limits the arrow keys to one axis; both work by default. |
loop | boolean | true | Arrow keys wrap from the last option to the first. |
disabled / required / name | boolean / boolean / string | None | Form state for every option; name submits the choice with a native form. |
ngModel / formControl | ControlValueAccessor | None | Binds the value to a template-driven or reactive form, including disabled state. |
GlassRadioGroupItem
<glass-radio-group-item>, button[glassRadioGroupItem]
| Input | Type | Default | Description |
|---|---|---|---|
value | string | None | The value this option sets. Required. |
label | string | None | Text beside the button; clicking it chooses the option. Use button[glassRadioGroupItem] with aria-label for a bare button. |
description | string | None | Muted line under the label, linked with aria-describedby. Shown only with a label. |
disabled | boolean | false | Skips the option and keeps it from being chosen. |