Builtin Library
README.md
image
Static image widget. Wraps a single image node whose src is fed
to the engine's image loader. Sizing comes from style.width and
style.height.
Exports
image(src: string, opts: ImageOpts?) -> WidgetNode— module returns the builder function directly.
Options:
id: string?— widget id.style: table?— passes through to the underlying node; supplywidth/heighthere.
Usage
local Z = require("@builtin::modules.zui")
-- By VFS path.
Z.image("/source/libs/@builtin/textures/uv_checker_bw.png", { style = { width = 64, height = 64 } })
-- By asset identity.
Z.image("@builtin::textures.uv_checker_bw", { style = { width = 64, height = 64 } })
Notes
- Stateless — no side effects beyond producing a widget table.
srcreaches the engine's image loader, which resolves these spellings: a VFS path (/source/...or/zero/source/...), an asset identity (@builtin::textures.uv_checker_bw), an asset guid, and an http URL. A path anchors at the VFS root, so name it from there.- A
srcthe loader cannot reach paints a[failed <src>]placeholder in place of the image. - Aspect ratio is whatever the engine's image renderer applies — this widget does not impose one.