ElixirOpentui.Element (ElixirOpentui v0.2.0)

Copy Markdown View Source

Core element struct representing a node in the UI tree.

Every UI component — whether built-in (box, text, input) or user-defined — produces an Element tree. The layout engine consumes this tree to compute positions, and the renderer paints it to the terminal.

Summary

Functions

Create an element from type, keyword attrs, and children list.

Types

element_type()

@type element_type() ::
  :box
  | :text
  | :label
  | :panel
  | :button
  | :input
  | :select
  | :checkbox
  | :scroll_box
  | :textarea
  | :tab_select
  | :line_number
  | :code
  | :markdown
  | :diff
  | :frame_buffer
  | :ascii_font
  | :component

t()

@type t() :: %ElixirOpentui.Element{
  attrs: map(),
  children: [t()],
  component: module() | nil,
  id: term(),
  style: ElixirOpentui.Style.t(),
  type: element_type()
}

Functions

new(type, attrs \\ [], children \\ [])

@spec new(element_type(), keyword(), [t()] | t()) :: t()

Create an element from type, keyword attrs, and children list.