Cell Buttons
Overview
Cell buttons are clickable canvas-drawn elements rendered at the right side of a cell. They are defined at the column level — the same buttons appear in every row of the column. A click fires a callback with the row index, column key, and button identifier.
ButtonDef
Use ButtonDef::new(id, label, style) to construct one:
ButtonStyle
Layout
Buttons are laid out right-to-left: the first entry in cell_buttons is
the rightmost button. This keeps positions stable when additional buttons are
added later.
The button width is estimated from the label length — no Canvas2D measurement
is performed at the scene layer. A column width of at least
(label_chars × font_size × 0.65 + padding_x × 2) × button_count + gaps + margin
is recommended.
Builder method
Click callback
Web layer (WebGridCanvas)
Leptos component
The callback signature is (row: u64, col_key: String, button_id: String).
Combining with cell content
Buttons are rendered on top of the cell's text content. To avoid overlap,
either widen the column or suppress text rendering by using an empty
CellFormat::Boolean:
Theme variables
All button colours and geometry are configurable via CSS custom properties:
Interaction notes
- A button click does not select the cell — the event is consumed before cell selection logic runs.
- Buttons are hit-tested against the last rendered frame's
ButtonZonelist, so they are always in sync with the visible layout. - Hover styling is not yet implemented; it is planned for a future release.