IconButton
A Fluent button that shows only an icon.
Example:
fluent.IconButton(fluent.FluentIcons.SETTINGS, tooltip="Settings")
fluent.IconButton(fluent.FluentIcons.SETTINGS, disabled=True)

Inherits: LayoutControl
Properties
Events
on_blur- Called when this button loses focus.on_click- Called when this button is clicked.on_focus- Called when this button receives focus.on_long_press- Called when this button is long-pressed.
Methods
focus- Requests focus for this button.
Example
Fluent IconButton
import flet_fluent_ui as fluent
import flet as ft
def main(page: ft.Page):
page.title = "Fluent IconButton"
def toggle_favorite(e: ft.Event[fluent.IconButton]):
favorite = e.control.icon == fluent.FluentIcons.STAR
e.control.icon = (
fluent.FluentIcons.STAR_FILLED if favorite else fluent.FluentIcons.STAR
)
status.value = "Added to favorites" if favorite else "Removed from favorites"
def share(e: ft.Event[fluent.IconButton]):
status.value = "Link copied"
status = ft.Text()
page.add(
ft.SafeArea(
content=ft.Column(
controls=[
ft.Row(
controls=[
fluent.IconButton(
fluent.FluentIcons.STAR,
key="favorite",
tooltip="Favorite",
on_click=toggle_favorite,
),
fluent.IconButton(
fluent.FluentIcons.SHARE,
tooltip="Share",
on_click=share,
),
fluent.IconButton(
fluent.FluentIcons.DELETE,
tooltip="Delete",
disabled=True,
),
],
),
status,
],
)
)
)
if __name__ == "__main__":
ft.run(main)

Properties
autofocusclass-attributeinstance-attribute
autofocus: bool = FalseWhether this button should be focused on initial display.
Events
on_blurclass-attributeinstance-attribute
on_blur: ControlEventHandler[IconButton] | None = NoneCalled when this button loses focus.
on_clickclass-attributeinstance-attribute
on_click: ControlEventHandler[IconButton] | None = NoneCalled when this button is clicked.
on_focusclass-attributeinstance-attribute
on_focus: ControlEventHandler[IconButton] | None = NoneCalled when this button receives focus.
on_long_pressclass-attributeinstance-attribute
on_long_press: ControlEventHandler[IconButton] | None = (
None
)Called when this button is long-pressed.