Rich text display with individually styled spans.
Props
spans(list of maps) -- list of span descriptors. Each span is a map with:text(string) -- the text content.size(number) -- font size in pixels.color(color) -- text color. SeeToddy.Iced.Color.font(string | map) -- font specification. SeeToddy.Iced.Font.link(string) -- makes this span a clickable link.underline(boolean) -- renders the span with an underline.strikethrough(boolean) -- renders the span with a strikethrough line.line_height(number) -- relative line height for this span.padding(number | map) -- padding around the span. A number applies uniformly; a map withtop,right,bottom,leftkeys sets per-side.highlight(map) -- visual highlight behind the span text. Accepts:background(color) -- background color. SeeToddy.Iced.Color.border(map) -- border around the highlight. Acceptscolor(color),width(number), andradius(number or list of 4 numbers).
width(length) -- widget width. Default: shrink. SeeToddy.Iced.Length.height(length) -- widget height. Default: shrink.size(number) -- default font size for all spans.font(string | map) -- default font for all spans.color(color) -- default text color for all spans.line_height(number | map) -- line height.wrapping-- text wrapping mode. SeeToddy.Iced.Wrapping.ellipsis(string) -- text ellipsis mode:"none","start","middle","end". Truncates text that overflows and inserts an ellipsis character at the given position.a11y(map) -- accessibility overrides. SeeToddy.Iced.A11y.
Events
%Widget{type: :click, id: "id:link_value"}-- emitted when a span link is clicked.
Summary
Functions
Sets accessibility annotations.
Converts this rich text struct to a ui_node() map via the Toddy.Iced.Widget protocol.
Sets the default text color for all spans.
Sets the text ellipsis mode. One of: "none", "start", "middle", "end".
Sets the default font for all spans.
Sets the widget height.
Sets the line height.
Creates a new rich text struct with optional keyword opts.
Sets the default font size for all spans.
Sets the list of span descriptors.
Sets the widget width.
Applies keyword options to an existing rich text struct.
Sets the text wrapping mode.
Types
@type option() :: {:spans, [map()]} | {:width, Toddy.Iced.Length.t()} | {:height, Toddy.Iced.Length.t()} | {:size, number()} | {:font, Toddy.Iced.Font.t()} | {:color, Toddy.Iced.Color.input()} | {:line_height, number() | map()} | {:wrapping, Toddy.Iced.Wrapping.t()} | {:ellipsis, String.t()} | {:a11y, Toddy.Iced.A11y.t()}
@type t() :: %Toddy.Iced.Widget.RichText{ a11y: Toddy.Iced.A11y.t() | nil, color: Toddy.Iced.Color.t() | nil, ellipsis: String.t() | nil, font: Toddy.Iced.Font.t() | nil, height: Toddy.Iced.Length.t() | nil, id: String.t(), line_height: number() | map() | nil, size: number() | nil, spans: [map()] | nil, width: Toddy.Iced.Length.t() | nil, wrapping: Toddy.Iced.Wrapping.t() | nil }
Functions
@spec a11y(rich_text :: t(), a11y :: Toddy.Iced.A11y.t()) :: t()
Sets accessibility annotations.
@spec build(rich_text :: t()) :: Toddy.Iced.ui_node()
Converts this rich text struct to a ui_node() map via the Toddy.Iced.Widget protocol.
@spec color(rich_text :: t(), color :: Toddy.Iced.Color.input()) :: t()
Sets the default text color for all spans.
Sets the text ellipsis mode. One of: "none", "start", "middle", "end".
@spec font(rich_text :: t(), font :: Toddy.Iced.Font.t()) :: t()
Sets the default font for all spans.
@spec height(rich_text :: t(), height :: Toddy.Iced.Length.t()) :: t()
Sets the widget height.
Sets the line height.
Creates a new rich text struct with optional keyword opts.
Sets the default font size for all spans.
Sets the list of span descriptors.
@spec width(rich_text :: t(), width :: Toddy.Iced.Length.t()) :: t()
Sets the widget width.
Applies keyword options to an existing rich text struct.
@spec wrapping(rich_text :: t(), wrapping :: Toddy.Iced.Wrapping.t()) :: t()
Sets the text wrapping mode.