Skip to main content

TeachingTip

A Fluent teaching tip: a callout that points at content to tell the user about a feature, opened and closed with open.

Example:

tip = fluent.TeachingTip(
content=fluent.Button("Save"),
title="Save automatically",
subtitle="Changes are saved as you type, so you can close this page "
"at any time.",
open=True,
)
TeachingTip
TeachingTip

Inherits: LayoutControl

Properties

  • buttons - Buttons shown in a row at the bottom of the tip, sharing its width.
  • content - The control the tip points at.
  • dismissible - Whether clicking outside the tip, or pressing Escape, closes it.
  • leading - An icon or control shown before title.
  • media - An image or other control shown at the edge of the tip, opposite the control it points at.
  • open - Whether the tip is shown.
  • placement - Where the tip opens relative to content.
  • show_close_button - Whether the tip has a close button in its corner.
  • subtitle - The text of the tip, below title.
  • title - The title of the tip, shown in bold.

Events

  • on_dismiss - Called when the tip is closed other than by setting open to False: by the user, or by resizing the window.

Example​

Fluent TeachingTip​

Sourceplay_arrowTry Online
import flet_fluent_ui as fluent

import flet as ft


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

def show_tip(e: ft.Event[fluent.HyperlinkButton]):
tip.open = True

def close_tip(e: ft.Event[fluent.FilledButton]):
tip.open = False

tip = fluent.TeachingTip(
content=fluent.Button("Save"),
title="Save your work",
subtitle="Your changes are kept on this device until you save them.",
leading=fluent.FluentIcons.LIGHTBULB,
placement=fluent.FlyoutPlacementMode.BOTTOM_LEFT,
buttons=[fluent.FilledButton("Got it", on_click=close_tip)],
)

page.add(
ft.SafeArea(
content=ft.Row(
controls=[
tip,
fluent.HyperlinkButton("What's new?", on_click=show_tip),
]
)
)
)


if __name__ == "__main__":
ft.run(main)
teaching_tip
Closing the tip with its button

Properties​

buttonsclass-attributeinstance-attribute​

buttons: list[Control] = field(default_factory=list)

Buttons shown in a row at the bottom of the tip, sharing its width.

contentinstance-attribute​

content: Control

The control the tip points at.

dismissibleclass-attributeinstance-attribute​

dismissible: bool = True

Whether clicking outside the tip, or pressing Escape, closes it.

leadingclass-attributeinstance-attribute​

leading: IconDataOrControl | None = None

An icon or control shown before title.

mediaclass-attributeinstance-attribute​

media: Control | None = None

An image or other control shown at the edge of the tip, opposite the control it points at.

It is not shown when the tip has buttons.

openclass-attributeinstance-attribute​

open: bool = False

Whether the tip is shown.

Resizing the window closes the tip, which calls on_dismiss.

placementclass-attributeinstance-attribute​

Where the tip opens relative to content.

show_close_buttonclass-attributeinstance-attribute​

show_close_button: bool = True

Whether the tip has a close button in its corner.

subtitleclass-attributeinstance-attribute​

subtitle: StrOrControl | None = None

The text of the tip, below title.

titleinstance-attribute​

title: StrOrControl

The title of the tip, shown in bold.

Events​

on_dismissclass-attributeinstance-attribute​

on_dismiss: ControlEventHandler[TeachingTip] | None = (
    None
)

Called when the tip is closed other than by setting open to False: by the user, or by resizing the window.

open is set to False before this is called.