Skip to main content

ListTile

A Fluent list tile: one row of a list, with a title and optional subtitle, leading icon and trailing control.

With a selection_mode, the tile can be selected: a selected tile shows an accent bar, or a checked checkbox in MULTIPLE mode.

Example:

fluent.ListTile(
title="Inbox",
subtitle="3 unread messages",
leading=fluent.FluentIcons.MAIL,
selection_mode=fluent.ListTileSelectionMode.SINGLE,
selected=True,
)
ListTile
ListTile

Inherits: LayoutControl

Properties

  • autofocus - Whether this tile should be focused on initial display.
  • leading - An icon or control shown before title.
  • selected - Whether this tile is selected.
  • selection_mode - Whether and how this tile can be selected.
  • subtitle - Secondary text shown below title.
  • title - The main text of this tile.
  • trailing - A control shown at the end of this tile.

Events

Example​

Fluent ListTile​

Sourceplay_arrowTry Online
import flet_fluent_ui as fluent

import flet as ft

FOLDERS = [
("Inbox", fluent.FluentIcons.MAIL_INBOX, "3 unread"),
("Sent", fluent.FluentIcons.SEND, None),
("Archive", fluent.FluentIcons.ARCHIVE, None),
]


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

def handle_select(e: ft.Event[fluent.ListTile]):
# Single selection: deselect the other folders.
for tile in tiles:
tile.selected = tile is e.control
status.value = f"Folder: {e.control.title}"

tiles = [
fluent.ListTile(
title=name,
subtitle=subtitle,
leading=icon,
selection_mode=fluent.ListTileSelectionMode.SINGLE,
selected=name == "Inbox",
on_selection_change=handle_select,
)
for name, icon, subtitle in FOLDERS
]
status = ft.Text("Folder: Inbox")

page.add(
ft.SafeArea(
content=ft.Column(width=280, controls=[*tiles, status]),
)
)


if __name__ == "__main__":
ft.run(main)
list_tile
Selecting the Sent folder

Properties​

autofocusclass-attributeinstance-attribute​

autofocus: bool = False

Whether this tile should be focused on initial display.

leadingclass-attributeinstance-attribute​

leading: IconDataOrControl | None = None

An icon or control shown before title.

selectedclass-attributeinstance-attribute​

selected: bool = False

Whether this tile is selected. Only used when selection_mode is not NONE.

In SINGLE mode, deselect the other tiles of the list in on_selection_change.

selection_modeclass-attributeinstance-attribute​

Whether and how this tile can be selected.

subtitleclass-attributeinstance-attribute​

subtitle: StrOrControl | None = None

Secondary text shown below title. It needs a title.

titleclass-attributeinstance-attribute​

title: StrOrControl | None = None

The main text of this tile.

trailingclass-attributeinstance-attribute​

trailing: Control | None = None

A control shown at the end of this tile.

Events​

on_clickclass-attributeinstance-attribute​

on_click: ControlEventHandler[ListTile] | None = None

Called when this tile is clicked.

on_selection_changeclass-attributeinstance-attribute​

on_selection_change: (
    ControlEventHandler[ListTile] | None
) = None

Called when the user selects or deselects this tile.

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