Radio#
- class marimo.ui.radio(options: Sequence[str] | dict[str, Any], value: str | None = None, *, label: str = '', on_change: Callable[[Any], None] | None = None)#
A radio group.
Example.
radiogroup = mo.ui.radio( options=['a', 'b', 'c'], value='a', label='choose one' )
radiogroup = mo.ui.radio( options={'one': 1, 'two': 2, 'three': 3}, value='one', label='pick a number' )
Attributes.
value: the value of the selected radio optionoptions: a dict mapping option name to option value
Initialization Args.
options: sequence of text options, or dict mapping option name to option valuevalue: default option name, if None, starts with nothing checkedlabel: optional text label for the elementon_change: optional callback to run when this element’s value changes
Public methods
Inherited from
UIElementform([label])Create a submittable form out of this
UIElement.Inherited from
Htmlbatch(**elements)Convert an HTML object with templated text into a UI element.
center()Center an item.
right()Right-justify.
left()Left-justify.
callout([kind])Create a callout containing this HTML element.
Public Data Attributes:
Inherited from
UIElementvalueThe element’s current value.
Inherited from
HtmltextA string of HTML representing this element.