Typography
TheChromiaText component simplifies text styling by providing direct access to the Chromia design system’s typography scale. It supports all standard Text widget properties with built-in typography integration.
Basic Usage
ChromiaText
A customizable text widget with built-in Chromia typography styles.Parameters
The text to display.
The typography type to apply. Determines the base text style from the Chromia typography scale.
Optional color override. If provided, this color will override the color from the typography style.
Additional text style to merge with the typography style. Use this to customize specific properties while maintaining the base typography style.
The margin around the text widget. Use this for adding spacing around the text without wrapping in additional widgets.
How the text should be aligned horizontally.
An optional maximum number of lines for the text to span. If the text exceeds the given number of lines, it will be truncated according to
overflow.How visual overflow should be handled. Common values:
TextOverflow.clip, TextOverflow.ellipsis, TextOverflow.fade.Whether the text should break at soft line breaks.
The font scaling strategy to use. Controls how the text scales relative to the configured font size.
Typography Types
The component supports all Chromia typography types:- Display:
displayLarge,displayMedium,displaySmall - Headline:
headlineLarge,headlineMedium,headlineSmall - Title:
titleLarge,titleMedium,titleSmall - Body:
bodyLarge,bodyMedium,bodySmall - Label:
labelLarge,labelMedium,labelSmall
Examples
Text with Color Override
Text with Margin
Custom Styled Text
Text with Overflow Handling
ChromiaRichText
A rich text widget with built-in Chromia typography styles for displaying multi-styled text.Parameters
The text to display as a TextSpan tree.
How the text should be aligned horizontally.
Whether the text should break at soft line breaks.
How visual overflow should be handled.
An optional maximum number of lines for the text to span.
The margin around the text widget.
Factory Constructors
ChromiaRichText.highlight
Creates a rich text widget with highlighted words.The full text to display.
List of words to highlight.
Base text style.
Style for highlighted text.
Whether highlighting is case-sensitive.
ChromiaRichText.labelValue
Creates a rich text widget for label-value pairs.The label text.
The value text.
Separator between label and value.
Style for the label.
Style for the value.
