For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /dolan/radio-group.md.

Radio Group

A list of options where tapping one selects it and clears the others.

Installation

npx @blotch/dolan add radio-group
import { UiRadioGroup, UiRadioGroupItem } from '../components/ui/radio-group';

Usage

src/app/app.ts
import { Component, signal } from '@angular/core';
import { UiRadioGroup, UiRadioGroupItem } from '../components/ui/radio-group';

@Component({
  selector: 'app-root',
  imports: [UiRadioGroup, UiRadioGroupItem],
  template: `
    <ui-radio-group [(value)]="plan">
      <ui-radio-group-item value="free">Free</ui-radio-group-item>
      <ui-radio-group-item value="pro">Pro, $9 a month</ui-radio-group-item>
    </ui-radio-group>
  `,
})
export class App {
  protected readonly plan = signal('free');
}
  • Each item shows a circle and its label. Tapping anywhere on the row selects it.
  • Items wrap their content in <text>, so pass plain text.
  • Once an option is selected, tapping it again keeps it selected. Start with '' for no selection.

Disabled

<ui-radio-group value="us" disabled>
  <ui-radio-group-item value="us">United States</ui-radio-group-item>
  <ui-radio-group-item value="eu">Europe</ui-radio-group-item>
</ui-radio-group>

Disabling the group dims every item and ignores taps. There's no per-item disabled.

Forms

value is a model(), so it works with every Angular forms API:

<ui-radio-group [formField]="profile.field" />
<ui-radio-group [formControl]="control" />
<ui-radio-group [(ngModel)]="value" />

Choosing an item marks the field touched. UiRadioGroup implements Signal Forms' FormValueControl. See Forms.

API

UiRadioGroup

InputTypeDefaultDescription
valuestring''The selected item's value. Supports [(value)].
disabledbooleanfalseDims every item and ignores taps.
classstring''Extra Tailwind classes for the column of items.
OutputTypeDescription
changedstringEmits the value of the item the user tapped.
valueChangestringEmits the new value, for [(value)].
touchvoidEmits when an item is chosen, for forms: the field counts as touched.

UiRadioGroupItem

InputTypeDefaultDescription
valuestringRequiredThe value this item selects.
classstring''Extra Tailwind classes for the row.

No outputs.

  • Select: pick one option from a bottom sheet
  • Checkbox: choose several independent options
  • Toggle: a single-select toggle group