Collections
Lists, tables, trees, tabs, expanders, and pages. rustdoc · source · icedtea · iced
Each constructor takes A11y unless noted. iced 0.14 publishes the widget id only.
The clip owns the list and table pixel offset. The rail and the
wheel write it. on_scroll fires when the mounted range changes or
the scroll arrives at 0 or max. Pass start..end back so view
builds that range. Jump with scroll_to on scroll_id. A new
selection that sits
outside the viewport moves the clip so that row is in view. Change
scroll_id when the row set is a different list (filter, page,
session) so the clip remounts at 0. Variable-height rows use
row_offsets / visible_range_var. scroll_id names the clip
pane on list_view, virtual_column, and data_table.
List
list — A virtualized row list.
Constructor: widget::list_view
Window, row height, overscan, scroll, empty copy, meta color,
scroll_id, face, and on_check sit on ListOpts.
empty is the copy when the model has no rows. Selection stays on
indices. A row press is ItemClick:
shift+primary extends, Command/Ctrl+primary toggles, secondary on a
selected row keeps the selection. Disabled drops row messages. Pass RowHeights::PerRow for variable
row heights (visible_range_var). RowFace::Flush is one clipped
line. RowFace::Card is a surface, wrapped title, and an optional
3px meter. ListModel::leading / trailing paint RowSlot::Icon,
RowSlot::Check, or RowSlot::Text (a small badge; RowSlot::text
is Quiet, or pass a Variant for role ink) on the same
virtualized rows. ListModel::indent insets a row from start.
on_check toggles a check slot.
The list is a focus::group: no Field-radius ring around the pane.
Selected row wash is the item face. A focused list moves the primary row with arrows, Page, Home, and
End. Primary click fires on release. on_context is the secondary
click.
Pass A11y.
Virtual column
virtual-column — Virtualized free-form rows with known heights.
Constructor: widget::virtual_column
The column is a focus::group: no Field-radius ring around the pane.
Same windowing as list (overscan, rail, wheel) for app-built faces —
expand cards, custom bodies. Build heights with
collection::expand_card_heights (closed estimate plus open-row
heights). on_click is the same ItemClick as list_view: primary
on release is select; secondary on press is context. Activate stays
Enter or an application message. Title/meta model lists stay on
list_view.
Pass A11y.
Log
log — Append-only lines that stick to the end.
Constructor: widget::log_view
Virtualizes long logs. Iced’s end anchor reports offset 0, so the log reads the reversed offset and mounts the tail. Empty lines show “No lines”.
Pass A11y.
Item grid
grid — Tiles that share the row width.
Constructor: widget::item_grid
Pass titles. Click sends the index. Empty grid is an empty column.
The grid is a focus::group: no Field-radius ring around the tile
wall. Selected tile is tonal; idle tiles are outlined.
Pass A11y.
Data table
table — A virtualized table. Last column fills.
Constructor: widget::data_table
TableModel holds headers and rows. on_cell is an ItemClick plus
the column.
on_sort is the header click. ColumnLayout order is scroll order;
frozen keeps the first n columns in view. on_h_scroll moves
the rest. scroll_id names the body clip for scroll_to.
TableSource::row_checked plus on_check paint a leading
checkbox column. Empty rows still paint headers.
Pass A11y.
Tree
tree — An expandable outline.
Constructor: widget::tree_view
The application owns expand state. Leaf rows have no twisty. Empty
tree is an empty column. animating is the branch that is opening or
closing and its 0–1 height progress. TreeFace::Outline
is a tight heading tree; titles wrap inside their slot.
TreeFace::Files is an explorer: folder and file marks from dir,
one title line. Both clip the title so a trailing badge stays on the
end. Selected wash covers the full row. Tokens.density scales
pad, gap, and indent. TreeNode::trailing is the same
RowSlot
as list_view; Text is a badge (RowSlot::text is Quiet).
A focused tree expands and collapses with arrows. Up and Down move
the selection.
Pass A11y.
Tabs
tabs — A tab bar over a body the application paints.
Constructor: widget::tab_bar
Tabs { closable: false } is pinned sections. Titles use the meta type
step. with_badge paints a count on a tab. with_icon paints
icon-plus-text. with_disabled
freezes one tab so press is skipped. tab_bar takes
secondary for a 1 dp underbar (3 dp when false). When max_width
is set and titles do not fit, extra enabled tabs move into a More list. Select
sends the index. See also
pattern::tab_view.
A focused bar moves with arrows. Enter and Space activate the
current tab.
Pass A11y.
Accordion
accordion — An open row shows a body under the header.
Constructor: widget::accordion_view
The application owns which row is open and a 0–1 progress for
height. Closed rows are headers only. The chevron sits on the
trailing edge.
A focused accordion moves with arrows. Enter and Space toggle the
open row.
Pass A11y.
Expander
expander — A card that clips its child until the header opens it.
Constructor: widget::expander
The application owns open and progress (0 peek, 1 full). Closed
shows a Peek of the child (pixels, or whole body lines with room
for the last descent) and fades the cut. Title starts; optional
trail sits after the title; the chevron sits on the trailing edge.
Accordion is many headers; this is one card.
Enter and Space toggle the header when the card is focused.
Pass A11y.
Pagination
pagination — Page through a long list.
Constructor: widget::pagination
Pass page count and the current page. Messages are previous, next, and jump. One page hides the control or disables the arrows. Arrows, Page, Home, and End move the page when the control is focused.
Pass A11y.