Avatar
A Shadcn avatar: a round image with a fallback for when it can't be shown.
Example:
shad.Avatar(src="https://github.com/shadcn.png", placeholder="CN")

Inherits: LayoutControl
Properties
bgcolor- The background color behindplaceholder.placeholder- The content shown when there is no image, typically the person's initials.size- The width and height of this avatar.src- The image to show: a URL, or a path relative to the app's assets directory.
Example
Shadcn Avatar
play_arrowTry Online
import flet_shadcn_ui as shad
import flet as ft
def main(page: ft.Page):
page.title = "Shadcn Avatar"
page.add(
ft.SafeArea(
content=ft.Row(
controls=[
shad.Avatar(
src="https://raw.githubusercontent.com/flet-dev/media/98b6df65ba919f2afef284ba04feb2d78f28e1d1/pictures/avatar-user.png",
placeholder="CN",
),
shad.Avatar(placeholder="JD"),
shad.Avatar(placeholder="AB", size=56),
shad.Avatar(
placeholder=ft.Icon(shad.LucideIcons.USER, size=20),
bgcolor=ft.Colors.PRIMARY_CONTAINER,
),
],
)
)
)
if __name__ == "__main__":
ft.run(main)

Properties
bgcolorclass-attributeinstance-attribute
bgcolor: ColorValue | None = NoneThe background color behind placeholder.
If None, the muted color of the theme is used.
placeholderclass-attributeinstance-attribute
placeholder: StrOrControl | None = NoneThe content shown when there is no image, typically the person's initials.
sizeclass-attributeinstance-attribute
size: Number | None = NoneThe width and height of this avatar.
If None, defaults to 40.
srcclass-attributeinstance-attribute
src: str | None = NoneThe image to show: a URL, or a path relative to the app's assets directory.
If None, or if the image fails to load, placeholder is shown.