plushie/ui
Ergonomic UI builder functions.
Provides convenience functions for building UI trees without importing individual widget modules. Uses an opaque Attr type for widget properties.
Types
Values
pub fn align_x(a: alignment.Alignment) -> Attr
Set horizontal alignment of the widget or its content.
pub fn align_y(a: alignment.Alignment) -> Attr
Set vertical alignment of the widget or its content.
pub fn button(
id: String,
label: String,
attrs: List(Attr),
) -> node.Node
Create a button widget with the given label text.
pub fn canvas(id: String, attrs: List(Attr)) -> node.Node
Create a canvas widget for custom drawing with shapes and paths.
pub fn checkbox(
id: String,
label: String,
checked: Bool,
attrs: List(Attr),
) -> node.Node
Create a checkbox widget with the given label and checked state.
pub fn clip(enabled: Bool) -> Attr
Enable or disable content clipping at the widget boundary.
pub fn column(
id: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create a vertical column layout widget.
pub fn container(
id: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create a container widget that wraps its children with optional padding, alignment, and sizing.
pub fn decorative(d: Bool) -> Attr
Mark an image as decorative (hidden from screen readers).
pub fn event_rate(r: Int) -> Attr
Set the per-widget event rate limit (events per second).
pub fn exists(tree_node: node.Node, id: String) -> Bool
Check whether a node with the given ID exists in the tree.
pub fn exit_on_close(e: Bool) -> Attr
Set whether the application exits when this window is closed.
pub fn find(
tree_node: node.Node,
id: String,
) -> option.Option(node.Node)
Search the tree for a node with the given ID. Returns None if not found.
pub fn floating(
id: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create a floating widget for content that hovers above other widgets.
pub fn grid(
id: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create a grid layout widget.
pub fn image(
id: String,
source: String,
attrs: List(Attr),
) -> node.Node
Create an image widget from a source path or handle.
pub fn keyed_column(
id: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create a keyed column layout for efficient child reconciliation.
pub fn markdown(
id: String,
content: String,
attrs: List(Attr),
) -> node.Node
Create a markdown widget that renders the given markdown content.
pub fn mouse_area(
id: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create a mouse area widget that captures mouse events on its children.
pub fn on_submit(enabled: Bool) -> Attr
Enable or disable the on_submit event for text input widgets.
pub fn overlay(
id: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create an overlay widget for popover-style content.
pub fn pane_grid(
id: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create a pane grid layout with resizable, splittable panes.
pub fn pin(
id: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create a pin widget for positioning a child at an absolute offset.
pub fn placeholder(p: String) -> Attr
Set the placeholder text shown when the input is empty.
pub fn progress_bar(
id: String,
range: #(Float, Float),
val: Float,
attrs: List(Attr),
) -> node.Node
Create a progress bar with the given min/max range and current value.
pub fn responsive(
id: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create a responsive layout widget that adapts to available space.
pub fn row(
id: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create a horizontal row layout widget.
pub fn scrollable(
id: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create a scrollable container widget.
pub fn secure(s: Bool) -> Attr
Enable secure (password) mode for text input, hiding characters.
pub fn sensor(
id: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create a sensor widget that reports its size and position changes.
pub fn slider(
id: String,
range: #(Float, Float),
val: Float,
attrs: List(Attr),
) -> node.Node
Create a slider widget with the given min/max range and current value.
pub fn stack(
id: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create a stack widget that layers children on top of each other.
pub fn text(
id: String,
content: String,
attrs: List(Attr),
) -> node.Node
Create a text widget displaying the given content string.
pub fn text_input(
id: String,
val: String,
attrs: List(Attr),
) -> node.Node
Create a single-line text input widget with the given value.
pub fn themer(
id: String,
theme: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create a themer widget that applies a local theme to its children.
pub fn tooltip(
id: String,
tip: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create a tooltip widget that shows tip text when hovering its children.
pub fn window(
id: String,
attrs: List(Attr),
children: List(node.Node),
) -> node.Node
Create a window node. Only detected at the root or as a direct child of the root node.
pub fn window_size(w: Float, h: Float) -> Attr
Set the initial window size in logical pixels.