Skip to main content

Tab

A tab of a TabView.

Example:

fluent.Tab(
"Document 1",
icon=fluent.FluentIcons.DOCUMENT,
content=ft.Text("Contents of document 1"),
on_close=close_tab,
)

Inherits: Control

Properties

  • content - The control shown below the tabs while this tab is selected.
  • icon - An icon or control shown before text.
  • text - The label of the tab.

Events

  • on_close - Called when the user closes this tab, with its close button or with Ctrl+W (Cmd+W on macOS) while it is selected.

Properties​

contentinstance-attribute​

content: Control

The control shown below the tabs while this tab is selected.

iconclass-attributeinstance-attribute​

icon: IconDataOrControl | None = None

An icon or control shown before text.

textinstance-attribute​

text: StrOrControl

The label of the tab.

Events​

on_closeclass-attributeinstance-attribute​

on_close: ControlEventHandler[Tab] | None = None

Called when the user closes this tab, with its close button or with Ctrl+W (Cmd+W on macOS) while it is selected.

The tab has a close button only if this is set. The tab is not removed automatically: remove it from TabView.tabs here.