View Source ElementTui.Component protocol (ElementTui v0.5.1)

Protocol that needs to be implemented to support a component

Designing a component is as simple as implementing the protocol for your type. For an example see the ElementTui.Component.Margin module.

Summary

Types

t()

All the types that implement this protocol.

Functions

Returns the minimal width and height requested by the Element and additional keywords

Returns the data needed to render your screen

Types

@type t() :: term()

All the types that implement this protocol.

Functions

Link to this function

calculate_dim(data, width, height)

View Source
@spec calculate_dim(any(), integer(), integer()) ::
  {integer(), integer(), Keyword.t()}

Returns the minimal width and height requested by the Element and additional keywords

The return value is a tuple with {width, height, keywords}

Keywords

[vflex: weight] Can grow vertically to take up more space relative to its weight (and other vflex elements) [hflex: weight] Can grow horizontally to take up more space relative to its weight (and other vflex elements)

Link to this function

parse(data, x, y, width, height)

View Source

Returns the data needed to render your screen