Radio Group

Radio button group for single selection from multiple choices.

The RadioGroup and RadioGroupItem components provide a group of radio buttons for selecting a single option.

Installation

bash
shellui add radio-group

Usage

Basic

<RadioGroup Value="@selected" ValueChanged="@HandleChanged">
  <RadioGroupItem Value="option1">Option 1</RadioGroupItem>
  <RadioGroupItem Value="option2">Option 2</RadioGroupItem>
  <RadioGroupItem Value="option3">Option 3</RadioGroupItem>
</RadioGroup>

@code {
    private string? selected;

    private void HandleChanged(string value)
    {
        selected = value;
    }
}

Two-way Binding

<RadioGroup @bind-Value="selectedSize">
  <RadioGroupItem Value="sm">Small</RadioGroupItem>
  <RadioGroupItem Value="md">Medium</RadioGroupItem>
  <RadioGroupItem Value="lg">Large</RadioGroupItem>
</RadioGroup>

@code {
    private string? selectedSize;
}

With Label

<div class="space-y-4">
  <Label>Select Size</Label>
  <RadioGroup @bind-Value="selectedSize">
    <RadioGroupItem Value="xs">Extra Small</RadioGroupItem>
    <RadioGroupItem Value="sm">Small</RadioGroupItem>
    <RadioGroupItem Value="md">Medium</RadioGroupItem>
    <RadioGroupItem Value="lg">Large</RadioGroupItem>
  </RadioGroup>
</div>

@code {
    private string? selectedSize;
}

Disabled Item

<RadioGroup @bind-Value="selected">
  <RadioGroupItem Value="active">Active</RadioGroupItem>
  <RadioGroupItem Value="disabled" Disabled="true">Disabled</RadioGroupItem>
  <RadioGroupItem Value="other">Other</RadioGroupItem>
</RadioGroup>

@code {
    private string? selected;
}

API Reference

RadioGroup

Parameter Type Default Description
Value string? null Currently selected value
ValueChanged EventCallback<string> — Fires when selection changes
ChildContent RenderFragment null RadioGroupItem children

RadioGroupItem

Parameter Type Default Description
Value string — Item value (required)
ChildContent RenderFragment null Item label content
Disabled bool false Disables this radio item

Accessibility

  • Proper ARIA attributes (role="radio", aria-checked)
  • Arrow key navigation between items
  • Screen reader compatible

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.