Documentation / Reference

Overview

Choose a primitive, layout helper, or drawing API, then configure its view-specific and shared modifiers.

Construct, configure, compose

Import refract::prelude::* to use constructors and ViewExt. Each component page documents its construction inputs, behavior, and relevant methods. Dimensions, paint, labels, and disabled state preserve the concrete builder type; structural modifiers such as padding and frame wrap the resulting view.

See View Modifiers for the shared API. Read Views for reactive composition and mounted identity.

Primitives

Basic boxes, content, and input: view() supplies the generic box, text and image display content, and field edits a bound string. Use fragment to group views without adding a host element. Add .on_press() to compose actions from views.

ViewPurpose
viewCreate a basic box for styling, semantics, or interaction.
textDisplay a string with typography, wrapping, and semantic labels.
imageDisplay an image from a URL, file path, or embedded asset.
fieldEdit a single-line or multiline string through a binding.
fragmentGroup a sequence of views without adding a host element.

Layout

Boxes configured to arrange children, consume available space, or provide a scrolling viewport.

ViewPurpose
stackArrange children with a configurable horizontal or vertical direction.
h_stackArrange children horizontally with spacing and alignment.
v_stackArrange children vertically with spacing and alignment.
z_stackLayer children in shared bounds.
spacerConsume remaining space inside a row or column.
scroll_viewPlace content in a viewport with initial positioning, following, and scroll observation.

Drawing

Use shape for filled or stroked geometry, canvas / canvas_with for vector drawing, shader / shader_with for application-owned WGSL, and Path to construct reusable geometry.

ViewPurpose
canvasDraw paths and effects in one portable layout and event target.
canvas_withPrepare tracked inputs independently, then draw from their committed snapshot.
shaderDisplay a bound WGSL program in one portable layout and event target.
shader_withPrepare tracked shader inputs independently, then render their committed snapshot.
shapeFill or stroke built-in geometry, an existing path, or your own Shape implementation.
CircleDraw the largest circle centered inside the supplied bounds.
EllipseDraw an ellipse that fills the supplied bounds.
RectangleDraw a closed rectangle that fills the supplied bounds.
PathConstruct shared vector paths in local logical pixels.