Packages
Multi-surface application runtime for Elixir. One TEA module renders to terminal, browser (LiveView), SSH, and MCP (agents). 30+ widgets, flexbox + CSS grid, AI agent runtime, distributed swarm with CRDTs, time-travel debugging, session recording, sandboxed REPL, and agentic commerce.
Current section
Files
Jump to
Current section
Files
examples/core/02_box_drawing/simple_boxes.exs
# Simple Box Drawing Example
# Demonstrates Raxol.Core.Box module capabilities
#
# Run with: mix run examples/core/02_box_drawing/simple_boxes.exs
alias Raxol.Core.{Buffer, Box}
# Create a buffer
buffer = Buffer.create_blank_buffer(70, 25)
# Draw title bar with double-line box
buffer =
buffer
|> Box.draw_box(1, 1, 68, 3, :double)
|> Buffer.write_at(3, 2, "Raxol.Core.Box - Box Drawing Examples", %{})
# Draw single-line box
buffer =
buffer
|> Box.draw_box(3, 5, 20, 5, :single)
|> Buffer.write_at(5, 6, "Single Line", %{})
# Draw double-line box
buffer =
buffer
|> Box.draw_box(26, 5, 20, 5, :double)
|> Buffer.write_at(28, 6, "Double Line", %{})
# Draw rounded box
buffer =
buffer
|> Box.draw_box(49, 5, 18, 5, :rounded)
|> Buffer.write_at(51, 6, "Rounded", %{})
# Draw heavy box with filled interior
buffer =
buffer
|> Box.draw_box(3, 11, 20, 7, :heavy)
|> Box.fill_area(4, 12, 18, 5, ".", %{})
|> Buffer.write_at(7, 14, "Heavy + Fill", %{})
# Draw dashed box
buffer =
buffer
|> Box.draw_box(26, 11, 20, 7, :dashed)
|> Buffer.write_at(30, 14, "Dashed", %{})
# Draw a nested box layout
buffer =
buffer
|> Box.draw_box(49, 11, 18, 7, :double)
|> Box.draw_box(50, 12, 16, 5, :single)
|> Buffer.write_at(53, 14, "Nested", %{})
# Draw horizontal and vertical lines
buffer =
buffer
|> Box.draw_horizontal_line(1, 19, 68, "=")
|> Box.draw_vertical_line(23, 5, 14, "|")
|> Box.draw_vertical_line(47, 5, 14, "|")
# Add footer
buffer =
buffer
|> Buffer.write_at(
2,
21,
"Horizontal lines (=) and vertical lines (|) demonstrated",
%{}
)
# Render to terminal
IO.puts("\n" <> Buffer.to_string(buffer) <> "\n")
IO.puts("Performance: All operations completed in < 1ms")
IO.puts("See bench/core/box_benchmark.exs for detailed metrics")