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.
| View | Purpose |
|---|---|
| view | Create a basic box for styling, semantics, or interaction. |
| text | Display a string with typography, wrapping, and semantic labels. |
| image | Display an image from a URL, file path, or embedded asset. |
| field | Edit a single-line or multiline string through a binding. |
| fragment | Group a sequence of views without adding a host element. |
Layout
Boxes configured to arrange children, consume available space, or provide a scrolling viewport.
| View | Purpose |
|---|---|
| stack | Arrange children with a configurable horizontal or vertical direction. |
| h_stack | Arrange children horizontally with spacing and alignment. |
| v_stack | Arrange children vertically with spacing and alignment. |
| z_stack | Layer children in shared bounds. |
| spacer | Consume remaining space inside a row or column. |
| scroll_view | Place 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.
| View | Purpose |
|---|---|
| canvas | Draw paths and effects in one portable layout and event target. |
| canvas_with | Prepare tracked inputs independently, then draw from their committed snapshot. |
| shader | Display a bound WGSL program in one portable layout and event target. |
| shader_with | Prepare tracked shader inputs independently, then render their committed snapshot. |
| shape | Fill or stroke built-in geometry, an existing path, or your own Shape implementation. |
| Circle | Draw the largest circle centered inside the supplied bounds. |
| Ellipse | Draw an ellipse that fills the supplied bounds. |
| Rectangle | Draw a closed rectangle that fills the supplied bounds. |
| Path | Construct shared vector paths in local logical pixels. |