dialog (cellium v0.1.0)

View Source

Dialog widget module for floating, centered containers.

A dialog is a specialized container that defaults to being centered on the screen (or its parent). It draws a border and can have a title, similar to a frame.

Usage

{dialog, [{id, my_dialog}, {title, "Confirm"}, {width, 40}, {height, 10}], [
    {text, [], "Are you sure?"},
    {hbox, [], [
        {button, [{id, yes_btn}], "Yes"},
        {button, [{id, no_btn}], "No"}
    ]}
]}

Properties

  • width (integer): Width of the dialog. Default: 40
  • height (integer): Height of the dialog. Default: 10
  • title (string): Title displayed in the top border.
  • position (atom): Defaults to centered.

Summary

Functions

Creates a new dialog container with centered position.

Creates a new dialog container with specified width and height.

Renders the dialog using the frame rendering logic.

Functions

new(Id)

-spec new(term()) -> map().

Creates a new dialog container with centered position.

new(Id, Width, Height)

-spec new(term(), integer(), integer()) -> map().

Creates a new dialog container with specified width and height.

render(Widget, Buffer)

-spec render(map(), map()) -> map().

Renders the dialog using the frame rendering logic.