Radio Group
A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.
Installation
Command to install the Radio Group component.
Component Guide
Use the following to build the Radio Group component.
from components.ui.radio_group import radio_groupSource Code & Dependencies
For manual installation, copy each of the source codes below in their respective locations.
components/core/core.py
components/ui/radio_group.py
Examples
Description
Radio group items with a description using the Field component.
Choice Card
Use field.label to wrap the entire Field for a clickable card-style selection.
Fieldset
Use field.set and field.legend to group radio items with a label and description.
Disabled
Use the disabled prop on radio.root to disable all items.
Invalid
Use aria-invalid on radio.item and data-invalid on field.root to show validation errors.
Choose how you want to receive notifications.
API Reference
radio_group.root
The container element for a set of radio options. Renders a native <fieldset role="radiogroup">. Setting disabled=True on the root automatically disables all descendant radio controls without needing to set it on each item individually.
radio_group.root(
radio_group.item(name="plan", value="free", id_="plan-free"),
radio_group.item(name="plan", value="pro", id_="plan-pro"),
disabled=False,
)
Any additional HTML props passed to radio_group.root are forwarded directly to the underlying <fieldset>.
radio_group.item
Represents an individual radio control wrapped in a native <label>. Automatically extracts native form input attributes (name, value, checked, disabled, aria-*, data-*, etc.) and attaches them to an internal sr-only <input type="radio">. If no children are passed, it automatically renders a radio_group.indicator.
radio_group.item(
name="framework",
value="reflex",
id_="framework-reflex",
default_checked=True,
)
Event handlers (e.g., on_change, on_click), accessibility attributes (aria_*), and state attributes (data_*) are automatically routed to the inner <input>.
radio_group.indicator
Renders the visual selection state inside the radio item. Controlled purely via peer CSS rules (peer-checked). If called without children, it defaults to rendering a centered styled dot (ITEM_INDICATOR_DOT).
radio_group.indicator()
radio_group.indicator(
rx.el.span(class_name="size-2 rounded-full bg-accent")
)