BrowseRadio Group

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/dom
Import

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>

InputTypeDefaultDescription
[(value)]stringNoneThe chosen option's value. (valueChange) emits when the user chooses one.
orientation'horizontal' | 'vertical'NoneLimits the arrow keys to one axis; both work by default.
loopbooleantrueArrow keys wrap from the last option to the first.
disabled / required / nameboolean / boolean / stringNoneForm state for every option; name submits the choice with a native form.
ngModel / formControlControlValueAccessorNoneBinds the value to a template-driven or reactive form, including disabled state.

GlassRadioGroupItem

<glass-radio-group-item>, button[glassRadioGroupItem]

InputTypeDefaultDescription
valuestringNoneThe value this option sets. Required.
labelstringNoneText beside the button; clicking it chooses the option. Use button[glassRadioGroupItem] with aria-label for a bare button.
descriptionstringNoneMuted line under the label, linked with aria-describedby. Shown only with a label.
disabledbooleanfalseSkips the option and keeps it from being chosen.