Radio Group

One choice among several, as native radios. In the look of the app's style.

FormsExperimental

Usage

import { Component, ViewEncapsulation, signal } from '@angular/core';import { FormField, form } from '@angular/forms/signals';import { ScField, ScRadio, ScRadioGroup } from '@semantic-components/ui';
@Component({  selector: 'app-radio-group-usage-demo',  imports: [FormField, ScRadio, ScRadioGroup, ScField],  template: `    <div      scRadioGroup      [formField]="spacingForm.spacing"      aria-label="Spacing"      class="w-fit"    >      <label scField orientation="horizontal">        <input scRadio value="default" />        Default      </label>      <label scField orientation="horizontal">        <input scRadio value="comfortable" />        Comfortable      </label>      <label scField orientation="horizontal">        <input scRadio value="compact" />        Compact      </label>    </div>  `,  host: { class: 'flex w-full justify-center' },  encapsulation: ViewEncapsulation.None,})export class RadioGroupUsageDemo {  private readonly spacingForm = form(signal({ spacing: 'comfortable' }));}

Anatomy

Native radio inputs that draw their own circle and dot, each with its value, in a group that holds the choice — a [formField] or [(value)] on the group. Each radio is in a horizontal field beside its text — the field is the label, a label is inside the field, or the field is inside a label (a choice card: the whole card clicks).

import { ScField, ScFieldContentWrapper, ScFieldDescription, ScFieldTitle, ScLabel, ScRadio, ScRadioGroup } from '@semantic-components/ui';
<div scRadioGroup [formField]="…" aria-label="…">  <!-- The field is the label: the radio and its text -->  <label scField orientation="horizontal">    <input scRadio value="…" />    …  </label>
  <!-- A label inside the field, with a description -->  <div scField orientation="horizontal">    <input scRadio value="…" />    <label scLabel>…</label>    <p scFieldDescription>…</p>  </div>
  <!-- The field inside a label: a choice card, the whole card clicks -->  <label scLabel>    <div scField orientation="horizontal">      <input scRadio value="…" />      <div scFieldContentWrapper>        <div scFieldTitle>…</div>        <p scFieldDescription>…</p>      </div>    </div>  </label></div>

Accessibility

  • Native radios: one Tab stop for the group, the arrows move the choice (mirrored right to left), Space picks.
  • Name the group (a fieldset's legend, or aria-label on the group); each radio by its label.
  • A description is read with its radio; invalid once touched (aria-invalid, from Signal Forms).

Why the group holds the choice

Signal Forms can also bind each native radio itself — a [formField] on each, the Angular way. That still works, but each radio then needs type="radio" in your template: Angular types a native input's [formField] by the type it sees there, so without it a field typed as a union ('off' | 'all' | 'one') doesn't compile. On the group, the field is typed by the group's value — any type, no type attribute, one [formField] — as Base UI and shadcn, where the group holds the value.

Examples

Description

Standard spacing for most use cases.

More space between elements.

Minimal spacing for dense layouts.

import { Component, ViewEncapsulation, signal } from '@angular/core';import { FormField, form } from '@angular/forms/signals';import {  ScField,  ScFieldDescription,  ScLabel,  ScRadio,  ScRadioGroup,} from '@semantic-components/ui';

Choice card

import { Component, ViewEncapsulation, signal } from '@angular/core';import { FormField, form } from '@angular/forms/signals';import {  ScField,  ScFieldContentWrapper,  ScFieldDescription,  ScFieldTitle,  ScLabel,  ScRadio,  ScRadioGroup,

Fieldset

Subscription Plan

Yearly and lifetime plans offer significant savings.

import { Component, ViewEncapsulation, signal } from '@angular/core';import { FormField, form } from '@angular/forms/signals';import {  ScField,  ScFieldDescription,  ScFieldset,  ScLegend,  ScRadio,  ScRadioGroup,} from '@semantic-components/ui';

Disabled

import { Component, ViewEncapsulation, signal } from '@angular/core';import { FormField, form } from '@angular/forms/signals';import { ScField, ScRadio, ScRadioGroup } from '@semantic-components/ui';
/** One choice disabled: dimmed, skipped by the arrows. (A whole field: disabled in its form.) */@Component({  selector: 'app-disabled-radio-group-demo',  imports: [FormField, ScRadio, ScRadioGroup, ScField],  template: `    <div

Read-only

import { Component, ViewEncapsulation, signal } from '@angular/core';import { FormField, form, readonly } from '@angular/forms/signals';import { ScField, ScRadio, ScRadioGroup } from '@semantic-components/ui';
/** Read-only in its form: the choice shows and takes focus, but doesn't change. */@Component({  selector: 'app-read-only-radio-group-demo',  imports: [FormField, ScRadio, ScRadioGroup, ScField],  template: `    <div

Invalid

Notification Preferences

Choose how you want to receive notifications.

import { Component, ViewEncapsulation, signal } from '@angular/core';import { FormField, form, required } from '@angular/forms/signals';import {  ScField,  ScFieldDescription,  ScFieldset,  ScLegend,  ScRadio,  ScRadioGroup,} from '@semantic-components/ui';

Horizontal

import { Component, ViewEncapsulation, signal } from '@angular/core';import { FormField, form } from '@angular/forms/signals';import { ScField, ScRadio, ScRadioGroup } from '@semantic-components/ui';
interface FilterFormModel {  filter: string;}
@Component({  selector: 'app-horizontal-radio-group-demo',

Form

Notification Preferences

import { Component, ViewEncapsulation, signal } from '@angular/core';import { FormField, form } from '@angular/forms/signals';import {  ScField,  ScFrame,  ScRadio,  ScRadioGroup,} from '@semantic-components/ui';
interface NotificationFormModel {

Custom Theme

import { Component, ViewEncapsulation, signal } from '@angular/core';import { FormField, form } from '@angular/forms/signals';import { ScField, ScRadio, ScRadioGroup } from '@semantic-components/ui';
@Component({  selector: 'app-custom-theme-radio-group-demo',  imports: [ScRadioGroup, ScRadio, FormField, ScField],  template: `    <div      class="space-y-3"

RTL

تباعد قياسي لمعظم حالات الاستخدام.

مساحة أكبر بين العناصر.

تباعد أدنى للتخطيطات الكثيفة.

import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation, signal } from '@angular/core';import { FormField, form } from '@angular/forms/signals';import {  ScField,  ScFieldDescription,  ScLabel,  ScRadio,  ScRadioGroup,} from '@semantic-components/ui';

API reference

Each part takes class, merged over the style (cn: a later class wins).

PartSelectorDescription
ScRadioGroupdiv[scRadioGroup] role="radiogroup"; the choice: value (a [formField], or two-way); orientation ('vertical', 'horizontal'); disabled; readonly (aria-readonly: the choice takes focus, the arrows move it, but it doesn't change). Checks the radio whose value matches, names its radios alike; invalid once touched.
ScRadioinput[scRadio] A native radio (its own type) in the style's look, its dot when checked: value (its option, any type); disabled.