Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofmodule widget.module·originates fromworld 07158574-5…

anchor

Corners a child to a screen edge. Root-only — must be the top-level widget of its registered screen. `anchor` is one of `TopLeft / TopCenter / TopRight / CenterLeft / Center / CenterRight / BottomLeft / BottomCenter / BottomRight`. `margin` is `{ top, right, bottom, left }`.

byzero-proxy @ DESKTOP-DB3UJOJ·posted 2mo ago
What it does

anchor

Corners a child to a screen edge. Root-only — must be the top-level widget of its registered screen. anchor is one of TopLeft / TopCenter / TopRight / CenterLeft / Center / CenterRight / BottomLeft / BottomCenter / BottomRight. margin is { top, right, bottom, left }.

Exports

This module returns the widget factory directly. There is no returned table.

  • anchor(anchor: AnchorPos, margin: Margin, children: { Node }?, opts: AnchorOpts?) -> Node — build an anchor widget node.

Types:

  • AnchorPos = "TopLeft" | "TopCenter" | "TopRight" | "CenterLeft" | "Center" | "CenterRight" | "BottomLeft" | "BottomCenter" | "BottomRight"
  • Margin = { number } — { top, right, bottom, left }.
  • Node = { [string]: any } — opaque widget node.
  • AnchorOpts = { id: string?, props: { [string]: any }?, style: { [string]: any }? }

Usage

local anchor = require("@builtin::modules.zui.widget.anchor")

local closeBtn = anchor("BottomRight", { 0, 16, 16, 0 }, {
    Z.btn("Close", { onClick = "close" }),
})
ui.registerScreen("close", closeBtn)

Notes

  • The widget MUST be the top-level node of its registered screen — the engine's anchor decoder only resolves at the screen root.
  • margin is injected into props.margin; anchor into props.anchor. opts.props is mutated in place — pass a fresh table if you reuse it across calls.
  • Single-child children (a single widget node) is normalised by node, so callers don't need to wrap a single child in { ... }.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

ZuiAnchor Module Corners a child to a screen edge. Root-only — must be the top-level widget of its registered screen. `anchor` is one of `TopLeft / TopCenter / TopRight / LeftCenter / Center / RightCenter / BottomLeft / BottomCenter / BottomRight`. `CenterLeft` / `CenterRight` are accepted aliases of `LeftCenter` / `RightCenter`. `margin` is `{ top, right, bottom, left }`. `anchor` and `margin` are written at the widget root (not inside `props`) because that's the shape `validate_tree` recommends for `WidgetType::Anchor` (see `top_level_keys` in `crates/zero_ui_protocol/src/widgets.rs`). Mirrors the manual-node construction `area.module` uses for the same reason. Consumers: local anchor = require("modules.deprecated.zui.widget.anchor") anchor("BottomRight", { 0, 16, 16, 0 }, { Z.btn("Close") })

anchorWidget(anchor: AnchorPos, margin: Margin, children: { Node }?, opts: AnchorOpts?) → Node

Corner a child to a screen edge. Root-only — must be the top-level widget of its registered screen. Emits `anchor` and `margin` at the widget root (not inside `props`) so the validator doesn't flag `prop-shape-misplaced`.

argtypedescription
anchorAnchorPosOne of `TopLeft / TopCenter / TopRight / LeftCenter / Center / RightCenter / BottomLeft / BottomCenter / BottomRight` (`CenterLeft` / `CenterRight` are accepted aliases).
marginMargin`{ top, right, bottom, left }` in pixels.
children{ Node }?Child widget array (single child OK).
optsAnchorOpts?Optional `{ id, props, style }`.

examples

anchor("BottomRight", { 0, 16, 16, 0 }, { Z.btn("Close") })
⌬ Types
AnchorPos = "TopLeft" | "TopCenter" | "TopRight" | "LeftCenter" | "CenterLeft" | "Center" | "RightCenter" | "CenterRight" | "BottomLeft" | "BottomCenter" | "BottomRight"Margin = { number }Node = { [string]: any }AnchorOpts = { id: string?, props: { [string]: any }?, style: ZuiStyle? }

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

3items
·
other · born here
▤file
▲ 0↑ born
backing path · modules/deprecated/zui.module/widget.module/anchor.module

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.