Raxol. HEEx
(Raxol v2.6.0)
View Source
EXPERIMENTAL -- HEEx template integration for Raxol.
Allows using Phoenix HEEx templates directly in terminal applications, with terminal-specific components and styling.
Raxol.HEEx.Components provides real Phoenix Component implementations
that emit HTML with data-terminal-component attributes.
compile_heex_for_terminal/2 parses this HTML and builds Raxol widget
trees compatible with the rendering pipeline.
Example
defmodule MyHEExApp do
use Raxol.HEEx
def render(assigns) do
~H"""
<.terminal_box padding={2} border="single">
<.terminal_text color="green" bold>
Hello, <%= @name %>!
</.terminal_text>
<.terminal_button phx-click="click_me" class="primary">
Click me!
</.terminal_button>
</.terminal_box>
"""
end
end
Summary
Functions
Compile HEEx templates for terminal rendering.
Convert rendered HTML (from Phoenix Components) to a Raxol widget tree.
Functions
Compile HEEx templates for terminal rendering.
Takes rendered HEEx HTML (a string with data-terminal-component attributes)
and converts it to Raxol widget tree maps compatible with the rendering pipeline.
Parameters
template- Raw HEEx template string (before Phoenix rendering)assigns- Map of template assigns for variable interpolation
Returns
A widget tree map: %{type: atom, children: list, style: map, ...}
Convert rendered HTML (from Phoenix Components) to a Raxol widget tree.
Parses HTML with data-terminal-component attributes and builds the
corresponding widget tree structure that the rendering pipeline expects.