mo.ui.radio
Create a radio button group for selecting one option.
Signature
mo.ui.radio(
options: Sequence[str] | dict[str, Any],
value: str | None = None,
inline: bool = False,
*,
label: str = "",
on_change: Callable[[Any], None] | None = None,
disabled: bool = False
)
Parameters
options
Sequence[str] | dict[str, Any]
required
List of options or dictionary mapping labels to values
Display options horizontally instead of vertically
Markdown label for the radio group
Whether the radio buttons are disabled
Examples
import marimo as mo
# Basic radio buttons
color = mo.ui.radio(
options=["Red", "Green", "Blue"],
value="Red",
label="**Choose a color:**"
)
color
# Inline radio buttons
size = mo.ui.radio(
options=["Small", "Medium", "Large"],
inline=True
)
# Radio with value mapping
priority = mo.ui.radio(
options={
"Low priority": 1,
"Medium priority": 2,
"High priority": 3
},
value=2
)
mo.md(f"Selected priority level: {priority.value}")