RichTextRun
RichTextRun is the building block for RichText.
A run is one continuous piece of text with one style. If a sentence has a bold product name inside otherwise normal prose, that sentence naturally becomes multiple runs.
Example
use fission::prelude::*;
let widget: Widget = RichText::new(vec![
RichTextRun::new("Status: "),
RichTextRun::new("Failed")
.weight(700)
.color(view.env.theme.tokens.colors.error),
])
.into();
This keeps the style change local to the important word without forcing the entire line to share the same emphasis.
Field table
| | | |
|---|
| | | |
| | Fully resolved style for the run. | Defaults to TextRunStyle::default(). Builder helpers usually feel nicer than editing this directly. |
| | Accessibility label override for this run. | |
| | Semantic identifier override for this run. | |
| | Whether assistive technology should spell out the run. | |
When to use runs and when not to
Use flat runs when you only need straightforward styling differences across one paragraph. If you need nested semantics, hover or tap actions on subranges, or inline widgets inside the text flow, move up to the span-based RichText::from_spans(...) model instead.
Production checklist
For RichTextRun, review the fields that change behavior before treating the widget as finished: text, style, semantics_label, semantics_identifier, spell_out. The goal is to make the product rule visible in state and actions, not hidden inside ad-hoc construction code.
If this widget appears inside an interactive flow, keep the surrounding action binding in the parent component and test that the flow still has one clear reducer path.
Use semantics when visible content alone is not enough for assistive technology, especially for icon-only controls or custom surfaces.
Add at least one component or harness test that confirms the visible text, semantic role, action dispatch, and layout constraint that matter for this widget in context.
If a screen starts repeating the same RichTextRun setup, extract a named component around this widget. That keeps the reference API small while making product code easier to read and safer for generated code to copy.
RichText, TextRunStyle, Text, and TextFontStyle.