Radio Group

A set of checkable buttons where only one can be checked at a time.

Default

Horizontal Layout

Radio groups are vertical by default. You can style them horizontally with CSS.

Horizontal

With Errors

Pass an errors list to display validation messages.

With Errors

Please select a priority

Disabled

Disable the entire group or individual options.

Disabled Group
Disabled Option

Standalone Radio

Use <.radio> directly for custom layouts.

Standalone

With Form

Radio groups integrate with Phoenix forms seamlessly.

<.form for={@form} phx-submit="save">
  <.radio_group name={@form[:plan].name} label="Select a plan">
    <:radio value="free" label="Free" />
    <:radio value="pro" label="Pro" />
    <:radio value="enterprise" label="Enterprise" />
  </.radio_group>
  <.button type="submit">Continue</.button>
</.form>