Component
Radio
A single-choice group. Bind the selected value, lay the options out vertically or horizontally, size and colour them, and swap plain radios for rich selectable cards. Works with template-driven and reactive forms.
Group & value
Selected: scan · last change: —
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { HbRadioImports } from '@herbst/ui';
@Component({
selector: 'hb-demo-radio-basic',
imports: [HbRadioImports],
template: `
<div class="flex flex-col gap-3">
<hb-radio-group [(hbValue)]="plan" hbName="plan" (hbChange)="last.set($any($event))">
<hb-radio [hbValue]="'press'">Press & mount</hb-radio>
<hb-radio [hbValue]="'scan'">Digitise only</hb-radio>
<hb-radio [hbValue]="'both'">Press & digitise</hb-radio>
</hb-radio-group>
<p class="font-mono text-[12px] text-muted-foreground">
Selected: {{ plan() }} · last change: {{ last() }}
</p>
</div>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HbDemoRadioBasicComponent {
protected readonly plan = signal('scan');
protected readonly last = signal('—');
}
Orientation, size & status
Radio cards
API reference
hb-radio-group
| Property | Description | Type | Default |
|---|---|---|---|
| [(hbValue)] | The selected value, two-way bound. Also works as a form control via ngModel / formControl. | unknown | null |
| [hbOrientation] | Stack the options in a column or a wrapping row. | 'vertical' | 'horizontal' | 'vertical' |
| [hbName] | The shared input name for the group (auto-generated if omitted). | string | '' |
| [hbSize] / [hbStatus] | Default size and validation colour, inherited by every radio unless overridden. | size xs–xl / 'default' | 'success' | 'warning' | 'error' | 'md' / 'default' |
| [hbDisabled] / [hbInvalid] | Disable the whole group, and mark it aria-invalid. | boolean | false |
| (hbChange) | Emits the newly selected value. | unknown | — |
hb-radio / hb-radio-card
| Property | Description | Type | Default |
|---|---|---|---|
| [hbValue] | The value this option contributes to the group. | unknown | null |
| [hbSize] / [hbStatus] | Per-option overrides of the group size and status. | size / status | inherit |
| [hbDisabled] / [hbInvalid] / [hbInputId] | Disable a single option, mark it invalid, or set its input id. | boolean / string | false |
| hb-radio-card [hbIndicator] | A card variant that projects rich content; hbIndicator toggles the radio circle. | boolean | true |