Container layout -- wraps a single child with padding, sizing, and styling.
Props
padding(number | map) -- padding inside the container. SeePlushie.Type.Padding.width(length) -- container width. Default: shrink. SeePlushie.Type.Length.height(length) -- container height. Default: shrink.max_width(number) -- maximum width in pixels.max_height(number) -- maximum height in pixels.center(boolean) -- center child in both axes. Default: false.clip(boolean) -- clip child that overflows. Default: false.align_x-- horizontal alignment::left,:center,:right. SeePlushie.Type.Alignment.align_y-- vertical alignment::top,:center,:bottom. SeePlushie.Type.Alignment.background(color | gradient) -- background fill. Accepts a hex color string,%{r, g, b, a}map, or a gradient map. SeePlushie.Type.Color,Plushie.Type.Gradient.color(color) -- text color override. SeePlushie.Type.Color.border(map) -- border specification:%{color, width, radius}. SeePlushie.Type.Border.shadow(map) -- shadow specification:%{color, offset, blur_radius}. SeePlushie.Type.Shadow.style-- named preset (:transparent,:rounded_box,:bordered_box,:dark,:primary,:secondary,:success,:danger,:warning) orStyleMap.t(). Overrides inline style props if both are set.a11y(map) -- accessibility overrides. SeePlushie.Type.A11y.
Summary
Functions
Sets accessibility annotations.
Aligns content to the bottom. Sets height and align_y: :bottom.
Aligns content to the left. Sets width and align_x: :left.
Aligns content to the right. Sets width and align_x: :right.
Aligns content to the top. Sets height and align_y: :top.
Sets the horizontal alignment of the child.
Sets the vertical alignment of the child.
Sets the background fill (color or gradient).
Sets the border specification.
Converts this container struct to a ui_node() map via the Plushie.Widget protocol.
Centers the child in both axes.
Centers content horizontally. Sets width and align_x: :center.
Centers content vertically. Sets height and align_y: :center.
Sets whether the child is clipped on overflow.
Sets the text color override.
Appends multiple children to the container.
Sets the container height.
Sets the maximum height in pixels.
Sets the maximum width in pixels.
Creates a new container struct with optional keyword opts.
Sets the container padding.
Appends a child to the container.
Sets the shadow specification.
Sets the named style.
Sets the container width.
Applies keyword options to an existing container struct.
Types
@type option() :: {:padding, Plushie.Type.Padding.t()} | {:width, Plushie.Type.Length.t()} | {:height, Plushie.Type.Length.t()} | {:max_width, number()} | {:max_height, number()} | {:center, boolean()} | {:clip, boolean()} | {:align_x, Plushie.Type.Alignment.t()} | {:align_y, Plushie.Type.Alignment.t()} | {:background, Plushie.Type.Color.input() | Plushie.Type.Gradient.t()} | {:color, Plushie.Type.Color.input()} | {:border, Plushie.Type.Border.t()} | {:shadow, Plushie.Type.Shadow.t()} | {:style, style()} | {:a11y, Plushie.Type.A11y.t() | map() | keyword()}
@type preset() ::
:warning
| :danger
| :success
| :secondary
| :primary
| :dark
| :bordered_box
| :rounded_box
| :transparent
@type style() :: preset() | Plushie.Type.StyleMap.t()
@type t() :: %Plushie.Widget.Container{ a11y: Plushie.Type.A11y.t() | nil, align_x: Plushie.Type.Alignment.t() | nil, align_y: Plushie.Type.Alignment.t() | nil, background: Plushie.Type.Color.t() | Plushie.Type.Gradient.t() | nil, border: Plushie.Type.Border.t() | nil, center: boolean() | nil, children: [Plushie.Widget.child()], clip: boolean() | nil, color: Plushie.Type.Color.t() | nil, height: Plushie.Type.Length.t() | nil, id: String.t(), max_height: number() | nil, max_width: number() | nil, padding: Plushie.Type.Padding.t() | nil, shadow: Plushie.Type.Shadow.t() | nil, style: style() | nil, width: Plushie.Type.Length.t() | nil }
Functions
@spec a11y(container :: t(), a11y :: Plushie.Type.A11y.t() | map() | keyword()) :: t()
Sets accessibility annotations.
@spec align_bottom(container :: t(), height :: Plushie.Type.Length.t()) :: t()
Aligns content to the bottom. Sets height and align_y: :bottom.
@spec align_left(container :: t(), width :: Plushie.Type.Length.t()) :: t()
Aligns content to the left. Sets width and align_x: :left.
@spec align_right(container :: t(), width :: Plushie.Type.Length.t()) :: t()
Aligns content to the right. Sets width and align_x: :right.
@spec align_top(container :: t(), height :: Plushie.Type.Length.t()) :: t()
Aligns content to the top. Sets height and align_y: :top.
@spec align_x(container :: t(), align_x :: Plushie.Type.Alignment.t()) :: t()
Sets the horizontal alignment of the child.
@spec align_y(container :: t(), align_y :: Plushie.Type.Alignment.t()) :: t()
Sets the vertical alignment of the child.
@spec background( container :: t(), background :: Plushie.Type.Color.input() | Plushie.Type.Gradient.t() ) :: t()
Sets the background fill (color or gradient).
@spec border(container :: t(), border :: Plushie.Type.Border.t()) :: t()
Sets the border specification.
@spec build(container :: t()) :: Plushie.Widget.ui_node()
Converts this container struct to a ui_node() map via the Plushie.Widget protocol.
Centers the child in both axes.
@spec center_x(container :: t(), width :: Plushie.Type.Length.t()) :: t()
Centers content horizontally. Sets width and align_x: :center.
@spec center_y(container :: t(), height :: Plushie.Type.Length.t()) :: t()
Centers content vertically. Sets height and align_y: :center.
Sets whether the child is clipped on overflow.
@spec color(container :: t(), color :: Plushie.Type.Color.input()) :: t()
Sets the text color override.
@spec extend(container :: t(), children :: [Plushie.Widget.child()]) :: t()
Appends multiple children to the container.
@spec height(container :: t(), height :: Plushie.Type.Length.t()) :: t()
Sets the container height.
Sets the maximum height in pixels.
Sets the maximum width in pixels.
Creates a new container struct with optional keyword opts.
@spec padding(container :: t(), padding :: Plushie.Type.Padding.t()) :: t()
Sets the container padding.
@spec push(container :: t(), child :: Plushie.Widget.child()) :: t()
Appends a child to the container.
@spec shadow(container :: t(), shadow :: Plushie.Type.Shadow.t()) :: t()
Sets the shadow specification.
Sets the named style.
@spec width(container :: t(), width :: Plushie.Type.Length.t()) :: t()
Sets the container width.
Applies keyword options to an existing container struct.