Skip to main content

RadioGroup

A Fluent radio group: a set of options where only one can be selected.

Example:

fluent.RadioGroup(
value="medium",
items=[
fluent.RadioButton(value="small", label="Small"),
fluent.RadioButton(value="medium", label="Medium"),
fluent.RadioButton(value="large", label="Large"),
],
)
RadioGroup
RadioGroup

Inherits: LayoutControl

Properties

Events

  • on_change - Called when the selected option changes.

Example​

Fluent RadioGroup​

Sourceplay_arrowTry Online
import flet_fluent_ui as fluent

import flet as ft


def main(page: ft.Page):
page.title = "Fluent RadioGroup"

def handle_change(e: ft.Event[fluent.RadioGroup]):
status.value = f"Size: {e.control.value}"

status = ft.Text("Size: medium")

page.add(
ft.SafeArea(
content=ft.Column(
controls=[
fluent.RadioGroup(
value="medium",
on_change=handle_change,
items=[
fluent.RadioButton(value="small", label="Small"),
fluent.RadioButton(value="medium", label="Medium"),
fluent.RadioButton(value="large", label="Large"),
],
),
status,
],
)
)
)


if __name__ == "__main__":
ft.run(main)
radio_group
Choosing Large

Properties​

horizontalclass-attributeinstance-attribute​

horizontal: bool = False

Whether to lay out items in a row instead of a column.

itemsclass-attributeinstance-attribute​

items: list[RadioButton] = field(default_factory=list)

The options of this group.

spacingclass-attributeinstance-attribute​

spacing: Number = 8

The space between items.

valueclass-attributeinstance-attribute​

value: str | None = None

The value of the selected option.

If None, no option is selected.

Events​

on_changeclass-attributeinstance-attribute​

on_change: ControlEventHandler[RadioGroup] | None = None

Called when the selected option changes.

The data property of the event handler argument contains the new value.