Raxol. HEEx. Components
(Raxol v2.6.0)
View Source
Terminal-specific Phoenix function components for HEEx templates.
These components render terminal UI elements within HEEx templates, providing a familiar Phoenix component syntax for terminal applications.
Usage
defmodule MyApp do
use Raxol.HEEx
def render(assigns) do
~H"""
<.terminal_box padding={2} border="single">
<.terminal_text color="green" bold>Hello!</.terminal_text>
</.terminal_box>
"""
end
endAvailable Components
terminal_box/1- Container with border and paddingterminal_text/1- Styled text elementterminal_button/1- Clickable buttonterminal_row/1- Horizontal layout containerterminal_column/1- Vertical layout containerterminal_input/1- Text input fieldterminal_progress/1- Progress barterminal_divider/1- Horizontal divider line
Summary
Functions
Renders a box container with optional border and padding.
Renders a clickable button.
Renders a vertical column container for layout.
Renders a horizontal divider line.
Renders a text input field.
Renders a progress bar.
Renders a horizontal row container for layout.
Renders styled text.
Functions
Renders a box container with optional border and padding.
Attributes
padding- Integer padding inside the box (default: 0)border- Border style: "single", "double", "rounded", "none" (default: "none")color- Text color (default: :default)background- Background color (default: :default)width- Fixed width (default: auto)height- Fixed height (default: auto)
Slots
inner_block- Required. The content to render inside the box.
Examples
<.terminal_box border="single" padding={1}>
Content here
</.terminal_box>
<.terminal_box border="double" color="blue" background="white">
Styled box
</.terminal_box>Attributes
padding(:integer) - Defaults to0.border(:string) - Defaults to"none".color(:any) - Defaults to:default.background(:any) - Defaults to:default.width(:integer) - Defaults tonil.height(:integer) - Defaults tonil.id(:string) - Defaults tonil.
Slots
inner_block(required)
Renders a clickable button.
Attributes
disabled- Whether the button is disabled (default: false)role- Button style: "primary", "secondary", "danger", "success" (default: "primary")phx-click- Phoenix click event name
Slots
inner_block- Required. The button label.
Examples
<.terminal_button phx-click="submit" role="primary">Submit</.terminal_button>
<.terminal_button disabled>Disabled</.terminal_button>Attributes
disabled(:boolean) - Defaults tofalse.role(:string) - Defaults to"primary".id(:string) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["phx-click", "phx-value-id"].
Slots
inner_block(required)
Renders a vertical column container for layout.
Attributes
gap- Space between children (default: 0)align- Horizontal alignment: "start", "center", "end" (default: "start")
Slots
inner_block- Required. The content to render in the column.
Examples
<.terminal_column gap={1}>
<.terminal_text>Line 1</.terminal_text>
<.terminal_text>Line 2</.terminal_text>
</.terminal_column>Attributes
gap(:integer) - Defaults to0.align(:string) - Defaults to"start".id(:string) - Defaults tonil.
Slots
inner_block(required)
Renders a horizontal divider line.
Attributes
char- Character to use for the divider (default: "-")width- Width of the divider (default: 40)color- Divider color (default: :default)
Examples
<.terminal_divider />
<.terminal_divider char="=" width={60} color="blue" />Attributes
char(:string) - Defaults to"-".width(:integer) - Defaults to40.color(:any) - Defaults to:default.id(:string) - Defaults tonil.
Renders a text input field.
Attributes
value- Current input value (default: "")placeholder- Placeholder text (default: "")disabled- Whether input is disabled (default: false)type- Input type: "text", "password" (default: "text")phx-change- Phoenix change event namephx-blur- Phoenix blur event name
Examples
<.terminal_input value={@query} phx-change="search" placeholder="Search..." />
<.terminal_input type="password" phx-change="set_password" />Attributes
value(:string) - Defaults to"".placeholder(:string) - Defaults to"".disabled(:boolean) - Defaults tofalse.type(:string) - Defaults to"text".id(:string) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["phx-change", "phx-blur", "phx-focus", "name"].
Renders a progress bar.
Attributes
value- Current progress (0-100, default: 0)max- Maximum value (default: 100)width- Bar width in characters (default: 20)color- Bar color (default: :green)show_percentage- Show percentage text (default: true)filled_char- Character for filled portion (default: "=")empty_char- Character for empty portion (default: "-")
Examples
<.terminal_progress value={75} />
<.terminal_progress value={@progress} color="blue" width={30} />Attributes
value(:integer) - Defaults to0.max(:integer) - Defaults to100.width(:integer) - Defaults to20.color(:any) - Defaults to:green.show_percentage(:boolean) - Defaults totrue.filled_char(:string) - Defaults to"=".empty_char(:string) - Defaults to"-".id(:string) - Defaults tonil.
Renders a horizontal row container for layout.
Attributes
gap- Space between children (default: 0)justify- Horizontal alignment: "start", "center", "end", "between" (default: "start")align- Vertical alignment: "start", "center", "end" (default: "start")
Slots
inner_block- Required. The content to render in the row.
Examples
<.terminal_row gap={2} justify="between">
<.terminal_text>Left</.terminal_text>
<.terminal_text>Right</.terminal_text>
</.terminal_row>Attributes
gap(:integer) - Defaults to0.justify(:string) - Defaults to"start".align(:string) - Defaults to"start".id(:string) - Defaults tonil.
Slots
inner_block(required)
Renders styled text.
Attributes
color- Text color (default: :default)background- Background color (default: :default)bold- Bold text (default: false)italic- Italic text (default: false)underline- Underlined text (default: false)strikethrough- Strikethrough text (default: false)dim- Dimmed text (default: false)
Slots
inner_block- Required. The text content.
Examples
<.terminal_text color="green" bold>Success!</.terminal_text>
<.terminal_text color="red" underline>Error</.terminal_text>Attributes
color(:any) - Defaults to:default.background(:any) - Defaults to:default.bold(:boolean) - Defaults tofalse.italic(:boolean) - Defaults tofalse.underline(:boolean) - Defaults tofalse.strikethrough(:boolean) - Defaults tofalse.dim(:boolean) - Defaults tofalse.id(:string) - Defaults tonil.
Slots
inner_block(required)