TwistArrow

TwistArrow — a small chevron that indicates and toggles a tree node's expansion.
Renders a right-pointing arrow when collapsed and a down-pointing arrow when
expanded; a leaf node (where has_children is false) paints nothing but
reserves its slot so the indent column stays aligned across all rows.
The glyph flips direction under right-to-left layout.
Accessibility-decorative: the chevron hides itself from the AT tree and
the parent row's node owns set_expanded.
// TwistArrow is typically instantiated by TreeView row delegates and requires
// an EventContext to wire the tap callback. The snippet below shows the
// construction pattern used inside a custom tree-row build().
let arrow = TwistArrow::new(16.0, true, false)
.on_click(|ctx| ctx.send_intent(teksilo_core::Intent::new("tree.toggle")));
Builder methods at a glance
color, on_click
API reference
📖 Full rustdoc API for this module
pub struct TwistArrow
Small interactive chevron rendered in the leading indent column of a tree row.
#![allow(unused)] fn main() { pub struct TwistArrow { /* fields */ } }
Methods
pub fn new(size: f32, has_children: bool, expanded: bool) -> Self
Construct a chevron. size is the square side length in logical pixels;
has_children determines whether the glyph is painted; expanded
determines the glyph direction (down = expanded, right/left = collapsed).
pub fn color(mut self, color: impl Into<ColorProp>) -> Self
Override the glyph colour. Accepts a Color, a TextRole, or a
Signal of either.
The default TextRole::Secondary is a muted grey, which is right on
every row that is not filled. It is not right on one that is: a
design language whose selected row is a solid accent capsule flips
its label to TextRole::OnAccent through
StandardItemStyle::selected_label_role, and a chevron left behind
at Secondary then sits on that capsule at roughly 2.5:1 — under
WCAG SC 1.4.11's 3:1 floor, and visibly wrong beside a white label.
StandardTreeItem passes the row's own label role here so the two
always move together.
pub fn on_click(mut self, f: impl Fn(&mut EventContext) + 'static) -> Self
Install a tap handler. Receives the firing EventContext
so consumers can dispatch intents (e.g. lazy-load children on
expand) or open dialogs from the chevron toggle.