Log inGet started
Package

viewport.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

viewport

Embedded 3D viewport rendered into the UI. target is a render-target handle id (paired with the Camera component's renderTarget setting). Use for in-UI minimaps, picture-in-picture, scene previewers.

Exports

  • viewport(target, opts?) -> Node — returns the viewport widget node. Module returns the builder function directly.

Types:

  • ViewportOpts = { id?, props?, style? }

Usage

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

viewport(minimapTarget, { style = { width = 200, height = 200 } })

Notes

  • Pair with a Camera component whose renderTarget matches target — the widget itself doesn't choose what to render, it just displays the target's contents.
  • Sizing comes from style.width / style.height (or layout); the target's pixel resolution is set when the render target is created.