Skip to main content

FontWeight

The thickness of the glyphs used to draw the text.

Inherits: enum.Enum

Properties

  • BOLD - A commonly used font weight that is heavier than normal, equal to w700.
  • NORMAL - The default font weight, equal to w400.
  • W_100 - Thin, the least thick.
  • W_200 - Extra-light.
  • W_300 - Light.
  • W_400 - Normal / regular / plain.
  • W_500 - Medium.
  • W_600 - Semi-bold.
  • W_700 - Bold.
  • W_800 - Extra-bold.
  • W_900 - Black, the most thick.

Examples

Showcase

import flet as ft

SAMPLE_TEXT = "Sphinx of black quartz"


def showcase_card(weight: ft.FontWeight) -> ft.Container:
return ft.Container(
width=300,
padding=12,
border=ft.Border.all(1, ft.Colors.RED),
border_radius=10,
bgcolor=ft.Colors.SURFACE_CONTAINER_LOW,
content=ft.Column(
spacing=8,
controls=[
ft.Text(weight.name, size=12, color=ft.Colors.ON_SURFACE_VARIANT),
ft.Text(SAMPLE_TEXT, weight=weight, size=24),
],
),
)


def main(page: ft.Page):
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER

page.appbar = ft.AppBar(title="FontWeight Showcase")
page.add(
ft.SafeArea(
content=ft.Column(
controls=[
ft.Text("Compare text thickness across all FontWeight values."),
ft.Row(
wrap=True,
spacing=12,
expand=True,
scroll=ft.ScrollMode.AUTO,
alignment=ft.MainAxisAlignment.CENTER,
controls=[showcase_card(weight) for weight in ft.FontWeight],
),
],
),
)
)


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

Properties

BOLDclass-attributeinstance-attribute

A commonly used font weight that is heavier than normal, equal to w700.

NORMALclass-attributeinstance-attribute

The default font weight, equal to w400.

W_100class-attributeinstance-attribute

Thin, the least thick.

W_200class-attributeinstance-attribute

Extra-light.

W_300class-attributeinstance-attribute

Light.

W_400class-attributeinstance-attribute

Normal / regular / plain.

W_500class-attributeinstance-attribute

Medium.

W_600class-attributeinstance-attribute

Semi-bold.

W_700class-attributeinstance-attribute

Bold.

W_800class-attributeinstance-attribute

Extra-bold.

W_900class-attributeinstance-attribute

Black, the most thick.