Tuix.Element (tuix v0.1.0)

Copy Markdown View Source

A node in the declarative UI tree.

Elements are plain data — the Elixir analog of OpenTUI's construct VNodes. Build them with the functions in Tuix.Components rather than directly.

Summary

Functions

Creates an element. props may be a keyword list or map. Children are flattened and nils removed, so conditional children (if ...) and comprehensions compose naturally.

Types

t()

@type t() :: %Tuix.Element{children: [t()], props: map(), tag: atom()}

Functions

new(tag, props \\ [], children \\ [])

@spec new(atom(), keyword() | map(), list()) :: t()

Creates an element. props may be a keyword list or map. Children are flattened and nils removed, so conditional children (if ...) and comprehensions compose naturally.