Skip to content

Placeholder

A placeholder box.

ft.Placeholder(
    expand=True,
    color=ft.Colors.RED_500,
)

Placeholder

Placeholder

Inherits: LayoutControl

Properties

Examples#

Live example

Basic Example#

import flet as ft


def main(page: ft.Page):
    page.add(
        ft.SafeArea(
            expand=True,
            content=ft.Placeholder(
                expand=True,
                color=ft.Colors.GREEN_ACCENT,
                fallback_height=200,
                fallback_width=300,
                stroke_width=20,
            ),
        )
    )


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

basic

Properties#

color class-attribute instance-attribute #

The color of the placeholder box.

content class-attribute instance-attribute #

content: Control | None = None

An optional Control to display inside the placeholder.

fallback_height class-attribute instance-attribute #

fallback_height: Number = 400.0

The height to use when the placeholder is in a situation with an unbounded height.

fallback_width class-attribute instance-attribute #

fallback_width: Number = 400.0

The width to use when the placeholder is in a situation with an unbounded width.

stroke_width class-attribute instance-attribute #

stroke_width: Number | None = 2.0

The width of the lines in the placeholder box.