Skip to content
Vetle444 edited this page Nov 10, 2023 · 1 revision

Label displays single-line and multi-line text. Text displayed by a Label can be colored, spaced, and can have text decorations.

Styles

We have defined three different categories of styles for Label:

  • Header
    • Bold font
  • UI
    • Medium-bold font
  • Body
    • Normal font

Each of these style categories has a different weight, such as: UI400, to control the font-size.

The default style is set to Body300

Inspect LabelStyle.cs to see all of the different styles.

Usage

Here we place a Label with a style of Body with a weight of 400.

<dui:Label Style="{dui:Styles Label=Body400}" />

Implementation

To make use of these styles you have to implement the font of your choice. This is done in MauiAppBuilder.cs.

builder.ConfigureFonts(fonts =>
{
    fonts.AddFont("OpenSans-Bold.ttf", "Header");
    fonts.AddFont("OpenSans-Medium.ttf", "UI");
    fonts.AddFont("OpenSans-Regular.ttf", "Body");
});

NB: It is important that the aliases are exactly Header, UI and Body.

Clone this wiki locally