Radio Group

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

Default
Select a plan

Horizontal Layout

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

Horizontal
Size

With Errors

Pass an errors list to display validation messages.

With Errors
Priority

Please select a priority

Disabled

Disable the entire group or individual options.

Disabled Group
Disabled group
Disabled Option
Availability

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>