Content
Type, icons, documents, and images. rustdoc · source · icedtea · iced
Each constructor takes A11y unless noted. iced 0.14 publishes the widget id only.
Select and copy
Readable body, code, and markdown share one contract (module
select):
drag a contiguous range of visible text, then host copy (Ctrl+C /
Cmd+C or icedtea::copy_text / icedtea::copy_rich). Typing does
not apply on these surfaces.
| Surface | Who owns the text | Range copy | Select all / full |
|---|---|---|---|
selectable, code | App text_editor::Content via select_only | Content::selection() → copy_text | Action::SelectAll / whole buffer |
markdown | Paint-side document (layout stays real) | MarkdownSpan → copy_rich | markdown_select_all / doc.source |
Labeled values use the same editor path under Fields
and field::Selectables. Chrome (menus, buttons, status meta) is not
drag-selectable. Drag across headings, paragraphs, and lists uses
select::markdown_select and MarkdownSpan::text / html.
Tables copy as the visible cells (tab-separated plain, a <table>
in HTML), the same as selecting rendered markdown in a browser.
Label
label — A line of type.
Constructor: widget::label
LabelFace picks Body, Meta, Display, or Figure. Platform sans.
Empty string is an empty node; still pass A11y.
Icon
icon — A chrome SVG: a shipped Icon or application bytes.
Constructor: widget::icon_svg
Icon is the desktop chrome set (Material Symbols Sharp; see
NOTICE). Pass
Glyph::Bytes
for an app mark (filled black paths). Tokens tint the fill.
material_symbol_sharp_url
and adapt_material_svg
are the crate path for more Sharp marks; see
More Material icons.
Pass A11y.
Tooltip
tooltip — Hover text on a child.
Constructor: widget::tooltip_wrap
TooltipAnchor picks follow-cursor, top, bottom, or start. Empty tip
text is a no-op wrap. The child keeps its own A11y.
Rich tooltip
rich-tooltip — Hover title plus supporting copy.
Constructor: widget::tooltip_rich
Optional action button and TooltipAnchor. Empty title, body, and
action is a no-op wrap. The child keeps its own A11y.
Hyperlink
link — A text link that sends a message.
Constructor: widget::hyperlink
The application opens the URL or navigates. Disabled paints muted text and drops the press.
Pass A11y.
Markdown
markdown — A parsed document.
Constructor: widget::markdown_view
Parse with MarkdownDoc::parse, then view the items. Truncate by
slicing the source before parse. Body is Tokens::body() (M3 Body
Medium times font_scale); H1 is Tokens::page() (same step as a
window title). Links and inline code use
Tokens::scheme() (primary, on_surface, surface_container_high).
Real markdown layout (headings, lists, code frames). Drag a range
with select::markdown_select (X and Y plus the live Tokens so
hit-testing matches the painted scale; a same-line drag is a
range). Consecutive clicks expand the range: word, sentence, then
the block. Pointer events reach markdown_select first so the
painted highlight and Copy are that span. A multi-block range
paints the gap between blocks. Copy is the span only: plain text plus HTML
(copy_rich). Select all is the primary+A chord
(markdown_select_all). The whole source is a separate Copy-all
path (doc.source).
Pass A11y.
Code
code — Source panel. syntax is an iced highlighter token; None is plain monospace.
Constructor: widget::highlighted_code
The application owns the buffer and the language name. Highlighter
face follows the active colorway (theme::code_highlight). Typing
does not change the buffer. Select and copy like selectable.
wrap is word wrap. Pass false so each source line stays one row
(diff hunks, search hits).
Pass A11y.
Image
image — A slot that keeps its box.
Constructor: widget::image_slot
Ready keeps the requested width and height. Missing bytes show the empty slot, not a collapsed layout.
Pass A11y.
Selectable
selectable — Body the user can drag-select and copy.
Constructor: widget::selectable
Looks like body text. The application owns text_editor::Content and
posts Content::selection() with icedtea::copy_text. FontFace::Ui
is prose; FontFace::Mono is a path or raw value. Disabled still
allows select-and-copy.
Pass A11y.