plushie/ui
Ergonomic UI builder functions.
Provides convenience functions for building UI trees without
importing individual widget modules. Each widget function accepts
a List(widget.Opt) of typed options specific to that widget,
giving compile-time validation of property names and types.
Values
pub fn button(
id: String,
label: String,
opts: List(button.Opt),
) -> node.Node
Create a button widget with the given label text.
pub fn canvas(
id: String,
w: length.Length,
h: length.Length,
opts: List(canvas.Opt),
) -> node.Node
Create a canvas widget for custom drawing with shapes and paths.
pub fn checkbox(
id: String,
label: String,
checked: Bool,
opts: List(checkbox.Opt),
) -> node.Node
Create a checkbox widget with the given label and checked state.
pub fn column(
id: String,
opts: List(column.Opt),
children: List(node.Node),
) -> node.Node
Create a vertical column layout widget.
pub fn combo_box(
id: String,
options: List(String),
value: String,
opts: List(combo_box.Opt),
) -> node.Node
Create a combo box (searchable dropdown).
pub fn container(
id: String,
opts: List(container.Opt),
children: List(node.Node),
) -> node.Node
Create a container widget that wraps its children with optional padding, alignment, and sizing.
pub fn floating(
id: String,
opts: List(floating.Opt),
children: List(node.Node),
) -> node.Node
Create a floating widget for content that hovers above other widgets.
pub fn grid(
id: String,
opts: List(grid.Opt),
children: List(node.Node),
) -> node.Node
Create a grid layout widget.
pub fn image(
id: String,
source: String,
opts: List(image.Opt),
) -> node.Node
Create an image widget from a source path or handle.
pub fn keyed_column(
id: String,
opts: List(keyed_column.Opt),
children: List(node.Node),
) -> node.Node
Create a keyed column layout for efficient child reconciliation.
pub fn markdown(
id: String,
content: String,
opts: List(markdown.Opt),
) -> node.Node
Create a markdown widget that renders the given markdown content.
pub fn memo(
key: String,
dependency: a,
content: fn() -> node.Node,
) -> node.Node
Mark a subtree for caching across render cycles. The content function is evaluated eagerly. The dependency is stored with the result so the runtime can skip re-normalization when the dependency hasn’t changed.
ui.memo("sidebar", model.sidebar_version, fn() {
sidebar_view(model.sidebar_data)
})
The key must be unique within siblings. The dependency can be any
value; it’s compared with == each render cycle.
pub fn overlay(
id: String,
opts: List(overlay.Opt),
children: List(node.Node),
) -> node.Node
Create an overlay widget for popover-style content.
pub fn pane_grid(
id: String,
opts: List(pane_grid.Opt),
children: List(node.Node),
) -> node.Node
Create a pane grid layout with resizable, splittable panes.
pub fn pick_list(
id: String,
options: List(String),
selected: option.Option(String),
opts: List(pick_list.Opt),
) -> node.Node
Create a pick list (simple dropdown select).
pub fn pin(
id: String,
opts: List(pin.Opt),
children: List(node.Node),
) -> node.Node
Create a pin widget for positioning a child at an absolute offset.
pub fn pointer_area(
id: String,
opts: List(pointer_area.Opt),
children: List(node.Node),
) -> node.Node
Create a pointer area widget that captures pointer events on its children.
pub fn progress_bar(
id: String,
range: #(Float, Float),
val: Float,
opts: List(progress_bar.Opt),
) -> node.Node
Create a progress bar with the given min/max range and current value.
pub fn qr_code(
id: String,
data: String,
opts: List(qr_code.Opt),
) -> node.Node
Create a QR code.
pub fn radio(
id: String,
value: String,
selected: option.Option(String),
label: String,
opts: List(radio.Opt),
) -> node.Node
Create a radio button.
pub fn responsive(
id: String,
opts: List(responsive.Opt),
children: List(node.Node),
) -> node.Node
Create a responsive layout widget that adapts to available space.
pub fn rich_text(
id: String,
opts: List(rich_text.Opt),
) -> node.Node
Create a rich text widget for styled text spans.
pub fn row(
id: String,
opts: List(row.Opt),
children: List(node.Node),
) -> node.Node
Create a horizontal row layout widget.
pub fn scrollable(
id: String,
opts: List(scrollable.Opt),
children: List(node.Node),
) -> node.Node
Create a scrollable container widget.
pub fn sensor(
id: String,
opts: List(sensor.Opt),
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,
opts: List(slider.Opt),
) -> node.Node
Create a slider widget with the given min/max range and current value.
pub fn stack(
id: String,
opts: List(stack.Opt),
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,
opts: List(text.Opt),
) -> node.Node
Create a text widget displaying the given content string.
pub fn text_editor(
id: String,
content: String,
opts: List(text_editor.Opt),
) -> node.Node
Create a multi-line text editor widget with the given content.
pub fn text_input(
id: String,
val: String,
opts: List(text_input.Opt),
) -> node.Node
Create a single-line text input widget with the given value.
pub fn themer(
id: String,
t: theme.Theme,
opts: List(themer.Opt),
children: List(node.Node),
) -> node.Node
Create a themer widget that applies a local theme to its children.
pub fn toggler(
id: String,
label: String,
is_toggled: Bool,
opts: List(toggler.Opt),
) -> node.Node
Create a toggler (on/off switch).
pub fn tooltip(
id: String,
tip: String,
opts: List(tooltip.Opt),
children: List(node.Node),
) -> node.Node
Create a tooltip widget that shows tip text when hovering its children.
pub fn vertical_slider(
id: String,
range: #(Float, Float),
value: Float,
opts: List(vertical_slider.Opt),
) -> node.Node
Create a vertical slider.
pub fn window(
id: String,
opts: List(window.Opt),
children: List(node.Node),
) -> node.Node
Create a window node. Only detected at the root or as a direct child of the root node.