Byte Engine Docs

UI module

Build retained, asynchronous interfaces in the Byte Engine render loop.

Use the early UI module to build retained, asynchronous interfaces inside the Byte Engine render loop.

An asynchronous component function receives a layout Context. It creates elements in stable named slots, waits for events, and can mount child components that return values. The runtime keeps state between evaluations, so your application does not rebuild each interaction from the beginning.

Choose the main API

  • layout::engine::Engine evaluates retained UI and produces render data.
  • Context and ContainerContext are the component-facing construction and event APIs.
  • Container, Text, TextField, Image, Curve, and Shape are the current built-in primitives.
  • UiRenderPass turns evaluated UI render data into GPU draw work.
  • ConcreteStyle, ConcreteLayer, Transform, and Visual hold styling, animation-oriented transforms, and opacity.

The layout layer stays small by design. Containers own sizing, positioning, flow, clipping, style, and visual data. Flow functions such as row, column, grid, and centered variants place children. Transforms are best treated as animation and presentation state, while position and sizing describe stable layout.

Handle events and focus

UI events are futures that your component can await. A component can wait for pointer-style events, keys, text edits, timers, or render ticks. Text input is app-owned: TextField emits edit deltas such as inserted and deleted characters, and application state decides how to apply them.

Components request and release focus explicitly. Send key and text-edit events to the focused element.

Work within the current limits

Primitive UI layer

The module isn't a complete widget toolkit yet. Treat it as a retained primitive layer with an asynchronous interaction model.

Build higher-level widgets through small composed components before you add runtime machinery.

When you add a UI feature, follow the existing route:

  • build or update a primitive
  • let layout evaluate geometry, clipping, and retained identity
  • let UiRenderPass consume the render data

That path keeps UI code testable and avoids coupling application widgets directly to renderer resource ownership.

Rust API

On this page