ExRatatui.Widgets.Block (ExRatatui v0.7.1)

Copy Markdown View Source

A container widget that provides borders and a title around other widgets.

Can be rendered standalone or used as the :block field on other widgets for composition. Supported by: Paragraph, List, Table, Gauge, LineGauge, Tabs, Checkbox, TextInput, Markdown, Textarea, Throbber, Popup, and WidgetList.

Fields

  • :title - optional title string displayed on the top border
  • :borders - list of border sides: :all, :top, :right, :bottom, :left
  • :border_style - %ExRatatui.Style{} for border color/modifiers
  • :border_type - :plain, :rounded, :double, or :thick
  • :style - %ExRatatui.Style{} for the inner area
  • :padding - {left, right, top, bottom} inner padding

Examples

iex> %ExRatatui.Widgets.Block{title: "My Panel", borders: [:all], border_type: :rounded}
%ExRatatui.Widgets.Block{
  title: "My Panel",
  borders: [:all],
  border_style: %ExRatatui.Style{},
  border_type: :rounded,
  style: %ExRatatui.Style{},
  padding: {0, 0, 0, 0}
}

iex> %ExRatatui.Widgets.Block{}
%ExRatatui.Widgets.Block{
  title: nil,
  borders: [],
  border_style: %ExRatatui.Style{},
  border_type: :plain,
  style: %ExRatatui.Style{},
  padding: {0, 0, 0, 0}
}

Summary

Types

border_side()

@type border_side() :: :all | :top | :right | :bottom | :left

border_type()

@type border_type() :: :plain | :rounded | :double | :thick

t()

@type t() :: %ExRatatui.Widgets.Block{
  border_style: ExRatatui.Style.t(),
  border_type: border_type(),
  borders: [border_side()],
  padding:
    {non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer()},
  style: ExRatatui.Style.t(),
  title: String.t() | nil
}