frame (cellium v0.1.0)
View SourceFrame widget module for rendering rectangular containers with borders and titles.
This module provides a container widget that draws a border around its contents and a title in the top border. The frame can contain child widgets and renders with different border styles depending on focus state.
Usage
Basic frame as a container:
{frame, [{id, my_frame}, {title, "My Frame"}, {size, 10}, {color, yellow}], [
{text_input, [{id, input1}, {expand, true}]}
]}Empty decorative frame:
frame:new(decorative_frame, 20, 5)Properties
width(integer): Width of the frame in characters.height(integer): Height of the frame in characters.orientation(atom): Layout orientation for children. Default: verticalpadding(map): Inner padding. Default: 1 on all sidestype: Set tocontainer(can hold child widgets)color(atom): Border colortitle(string): Title text to display in the top bordertitle_align(atom): Alignment of the title:left,center,right. Default:left
Border Styles
- Unfocused: Square/single-line border (
┌─┐│└┘) - Focused or child has focus: Double-line border (
╔═╗║╚╝)
Container Behavior
The frame is a container widget, so:
- It can have children specified in the DSL
- The layout system calculates dimensions for children
- Default padding of 1 character on all sides
- Children are laid out vertically by default
Example
{frame, [{id, input_frame}, {title, "Details"}, {size, 5}, {color, cyan}], [
{text_input, [{id, ti1}, {wrap, true}, {expand, true}]}
]}
Summary
Functions
Creates a new frame with default dimensions (0x0).
Creates a new frame with specified dimensions.
Renders the frame border and title.
Functions
Creates a new frame with default dimensions (0x0).
-spec new(term(), non_neg_integer(), non_neg_integer()) -> map().
Creates a new frame with specified dimensions.
The frame is a container that can hold child widgets. Children are laid out vertically with 1 character padding on all sides.
Renders the frame border and title.
Border style changes based on focus:
- Focused or child has focus: double-line border
- Unfocused: square/single-line border