ExRatatui.Widgets.Popup (ExRatatui v0.7.1)

Copy Markdown View Source

A centered modal overlay widget.

Renders a widget centered over the parent area, clearing the background underneath. Useful for dialogs, confirmations, command palettes, and autocomplete popups.

The popup size can be specified as a percentage of the parent area or as fixed dimensions. Fixed dimensions take precedence when set.

Examples

iex> %ExRatatui.Widgets.Popup{}
%ExRatatui.Widgets.Popup{
  content: nil,
  block: nil,
  percent_width: 60,
  percent_height: 60,
  fixed_width: nil,
  fixed_height: nil
}

iex> alias ExRatatui.Widgets.{Popup, Paragraph, Block}
iex> %Popup{
...>   content: %Paragraph{text: "Are you sure?"},
...>   block: %Block{title: "Confirm", borders: [:all], border_type: :rounded},
...>   percent_width: 50,
...>   percent_height: 30
...> }
%ExRatatui.Widgets.Popup{
  content: %ExRatatui.Widgets.Paragraph{text: "Are you sure?"},
  block: %ExRatatui.Widgets.Block{title: "Confirm", borders: [:all], border_type: :rounded},
  percent_width: 50,
  percent_height: 30,
  fixed_width: nil,
  fixed_height: nil
}

Summary

Types

t()

@type t() :: %ExRatatui.Widgets.Popup{
  block: ExRatatui.Widgets.Block.t() | nil,
  content: ExRatatui.widget() | nil,
  fixed_height: non_neg_integer() | nil,
  fixed_width: non_neg_integer() | nil,
  percent_height: non_neg_integer(),
  percent_width: non_neg_integer()
}