use fission::prelude::*;
let widget: Widget = RichText::new(vec![
RichTextRun::new("Build status: "),
RichTextRun::new("Passed")
.weight(700)
.color(view.env.theme.tokens.colors.primary),
])
.max_lines(1)
.into();
Field | Type | Meaning | Notes / default behavior |
|---|---|---|---|
id | Option<WidgetId> | Stable widget identity. | Defaults to None. |
runs | Vec<RichTextRun> | The styled runs that make up the text block. | RichText::new(...) fills this for you. |
inline_widgets | Vec<InlineWidgetSpan> | Inline widgets embedded in the text flow. | Usually produced through RichText::from_spans(...), not built manually. |
annotations | Vec<RichTextAnnotation> | Advanced semantic and interaction annotations over byte ranges. | Usually generated from span builders rather than authored by hand. |
semantics | Option<Semantics> | Optional wrapper semantics for the whole block. | Defaults to None. |
Field | Type | Meaning | Notes / default behavior |
|---|---|---|---|
width | Option<f32> | Fixed width. | Defaults to None. |
height | Option<f32> | Fixed height. | Defaults to None. |
min_width | Option<f32> | Minimum width. | Defaults to None. |
max_width | Option<f32> | Maximum width. | Defaults to None. |
min_height | Option<f32> | Minimum height. | Defaults to None. |
max_height | Option<f32> | Maximum height. | Defaults to None. |
wrap | bool | Whether lines may wrap. | RichText::new(...) and from_spans(...) set this to true. Raw Default construction does not. |
text_align | IrTextAlign | Paragraph alignment. | Defaults to the intermediate representation (IR) default. |
text_direction | IrTextDirection | Paragraph direction. | Defaults to the IR default. |
text_width_basis | IrTextWidthBasis | Width calculation policy. | Defaults to the IR default. |
max_lines | Option<usize> | Maximum number of visible lines. | Defaults to None. |
overflow | IrTextOverflow | Overflow behavior for clipped text. | Defaults to visible overflow. |
strut_line_height | Option<f32> | Paragraph strut line height. | Defaults to None. |
text_height_behavior | IrTextHeightBehavior | Paragraph height trimming behavior. | Defaults to the IR default. |
selection_range | Option<(usize, usize)> | Highlighted text selection range. | Defaults to None. |
selection_color | Option<IrColor> | Selection highlight color override. | Defaults to None. |
selection_text_color | Option<IrColor> | Selected text color override. | Defaults to None. |
flex_grow | f32 | Extra width or height the text block may absorb in flex layout. | Defaults to 0.0. |
flex_shrink | f32 | How much the block may shrink in tight layouts. | Defaults to 0.0. |