development-plugin-for-avalonia

Typography, Iconography, and Content Hierarchy in Avalonia

Table of Contents

  1. Scope and Primary APIs
  2. Type Roles
  3. Font Strategy
  4. Icon Strategy
  5. Content Hierarchy Rules
  6. AOT and Performance Notes
  7. Do and Don’t Guidance
  8. Troubleshooting
  9. Official Resources

Scope and Primary APIs

Use this reference to establish readable hierarchy and polished content rhythm.

Primary APIs:

Type Roles

Use a small role system:

Example:

<Styles xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Style Selector="TextBlock.eyebrow">
    <Setter Property="FontSize" Value="12" />
    <Setter Property="FontWeight" Value="SemiBold" />
    <Setter Property="Foreground" Value="{DynamicResource Brush.Text.Secondary}" />
  </Style>
  <Style Selector="TextBlock.title">
    <Setter Property="FontSize" Value="22" />
    <Setter Property="FontWeight" Value="SemiBold" />
    <Setter Property="Foreground" Value="{DynamicResource Brush.Text.Primary}" />
  </Style>
  <Style Selector="TextBlock.body">
    <Setter Property="FontSize" Value="14" />
    <Setter Property="TextWrapping" Value="Wrap" />
    <Setter Property="Foreground" Value="{DynamicResource Brush.Text.Primary}" />
  </Style>
  <Style Selector="TextBlock.meta">
    <Setter Property="FontSize" Value="12" />
    <Setter Property="TextTrimming" Value="CharacterEllipsis" />
    <Setter Property="Foreground" Value="{DynamicResource Brush.Text.Secondary}" />
  </Style>
</Styles>

Font Strategy

Cross-platform defaults:

public static AppBuilder BuildAvaloniaApp() =>
    AppBuilder.Configure<App>()
        .UsePlatformDetect()
        .WithInterFont();

Icon Strategy

Use PathIcon for vector icons that should inherit text color and scale predictably.

<StackPanel xmlns="https://github.com/avaloniaui"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Orientation="Horizontal"
            Spacing="8">
  <PathIcon Data="{StaticResource Icon.Search}" />
  <TextBlock Classes="body" Text="Search incidents" />
</StackPanel>

Guidance:

Content Hierarchy Rules

AOT and Performance Notes

Do and Don’t Guidance

Do:

Do not:

Troubleshooting

  1. Text hierarchy feels muddy.
    • Reduce the number of roles and increase spacing contrast between groups.
  2. Secondary text dominates.
    • Lower contrast or weight for metadata instead of shrinking everything.
  3. Icons feel inconsistent.
    • Standardize geometry source, icon size, and foreground treatment.

Official Resources