Alaja.Components.Separator (Alaja v2.4.0)

Copy Markdown View Source

Static horizontal separator line for terminal output.

Usage

iex> Alaja.Components.Separator.print()
# Prints ─────────────────────────────

iex> Alaja.Components.Separator.print("Section Title")
# Prints ─── Section Title ───────────

Cell engine

As of v0.3.0, render/2 returns an Alaja.Buffer.t/0. Use Alaja.Buffer.to_iodata/1 or Alaja.Printer.print_buffer/2 to emit it; print/2 does that for you.

Summary

Functions

Prints a separator line directly to stdout.

Renders a separator to an Alaja.Buffer.t/0.

Functions

print(text \\ nil, opts \\ [])

@spec print(
  String.t() | nil,
  keyword()
) :: :ok

Prints a separator line directly to stdout.

Options

  • :char - Character to use (default: "─")
  • :text - Optional centered label
  • :color - RGB tuple (default: dark gray)
  • :width - Total width (default: 80)

render(text \\ nil, opts \\ [])

@spec render(
  String.t() | nil,
  keyword()
) :: Alaja.Buffer.t()

Renders a separator to an Alaja.Buffer.t/0.

The buffer has height 1 and width matching :width. The optional centered text breaks the line into three segments (left fill, label, right fill), all rendered with the same foreground color.