Plushie.Canvas.Text (Plushie v0.7.2)

Copy Markdown View Source

Canvas text element with position, content, and optional font styling.

Summary

Functions

Horizontal alignment: "left", "center", "right".

Vertical alignment: "top", "center", "bottom".

Converts this widget struct to a ui_node() map.

Text string to draw.

Text fill color.

Font specification.

Creates a new element without an explicit ID (auto-assigned by parent container).

Creates a new element with the given ID, positional args, and keyword options.

Opacity from 0.0 to 1.0.

Font size in pixels.

Returns the element type string for the wire protocol.

Applies keyword options to an existing widget struct.

X position in pixels.

Y position in pixels.

Types

Functions

align_x(widget, descriptor)

@spec align_x(widget :: t(), value :: (String.t() | atom()) | nil) :: t()

Horizontal alignment: "left", "center", "right".

Accepts String.t() | atom().

align_y(widget, descriptor)

@spec align_y(widget :: t(), value :: (String.t() | atom()) | nil) :: t()

Vertical alignment: "top", "center", "bottom".

Accepts String.t() | atom().

build(widget)

@spec build(widget :: t()) :: Plushie.Widget.ui_node()

Converts this widget struct to a ui_node() map.

content(widget, descriptor)

@spec content(widget :: t(), value :: (String.t() | atom()) | nil) :: t()

Text string to draw.

Accepts String.t() | atom().

fill(widget, descriptor)

@spec fill(widget :: t(), value :: term() | nil) :: t()

Text fill color.

Accepts term().

font(widget, descriptor)

@spec font(widget :: t(), value :: (String.t() | atom()) | nil) :: t()

Font specification.

Accepts String.t() | atom().

new(x, y, content)

new(id, x, y, content)

Creates a new element without an explicit ID (auto-assigned by parent container).

new(id, x, y, content, opts)

Creates a new element with the given ID, positional args, and keyword options.

opacity(widget, descriptor)

@spec opacity(widget :: t(), value :: number() | nil) :: t()

Opacity from 0.0 to 1.0.

Accepts number().

size(widget, descriptor)

@spec size(widget :: t(), value :: number() | nil) :: t()

Font size in pixels.

Accepts number().

type_name()

@spec type_name() :: String.t()

Returns the element type string for the wire protocol.

with_options(widget, opts)

@spec with_options(widget :: t(), opts :: [option()]) :: t()

Applies keyword options to an existing widget struct.

x(widget, descriptor)

@spec x(widget :: t(), value :: number() | nil) :: t()

X position in pixels.

Accepts number().

y(widget, descriptor)

@spec y(widget :: t(), value :: number() | nil) :: t()

Y position in pixels.

Accepts number().