GPUI.Builder (gpui v0.2.0)

Copy Markdown View Source

Programmatic builders for immutable GPUI.Element trees.

Most views use the ~GPUI template sigil. Import this module explicitly when pipe-style construction is a better fit for generated or data-driven trees.

Summary

Functions

Sets background color.

Adds a child to an element for pipe-style view construction.

Creates a div element.

Adds flex display style to an element.

Adds column flex direction to an element.

Centers children on the cross axis.

Centers children on the main axis.

Represents a GPUI pixel length.

Represents a GPUI RGB color.

Sets width and height to the same value.

Sets a schema-backed style on an element.

Creates a text node.

Functions

bg(element, color)

@spec bg(GPUI.Element.t(), term()) :: GPUI.Element.t()

Sets background color.

child(element, child)

Adds a child to an element for pipe-style view construction.

div()

(macro)

Creates a div element.

div(attrs)

(macro)

div(attrs, list)

(macro)

flex(element)

@spec flex(GPUI.Element.t()) :: GPUI.Element.t()

Adds flex display style to an element.

flex_col(element)

@spec flex_col(GPUI.Element.t()) :: GPUI.Element.t()

Adds column flex direction to an element.

items_center(element)

@spec items_center(GPUI.Element.t()) :: GPUI.Element.t()

Centers children on the cross axis.

justify_center(element)

@spec justify_center(GPUI.Element.t()) :: GPUI.Element.t()

Centers children on the main axis.

px(value)

@spec px(number()) :: {:px, float()}

Represents a GPUI pixel length.

rgb(value)

@spec rgb(non_neg_integer()) :: {:rgb, non_neg_integer()}

Represents a GPUI RGB color.

size(element, size)

@spec size(GPUI.Element.t(), term()) :: GPUI.Element.t()

Sets width and height to the same value.

style(element, name, value)

@spec style(GPUI.Element.t(), atom(), term()) :: GPUI.Element.t()

Sets a schema-backed style on an element.

text(value)

(macro)

Creates a text node.