Plushie.Widget.Column (Plushie v0.6.0)

Copy Markdown View Source

Column layout -- arranges children vertically.

Props

  • spacing (number) -- vertical space between children in pixels. Default: 0.
  • padding (number | map) -- padding inside the column. Accepts a uniform number or %{top, right, bottom, left} map. See Plushie.Type.Padding.

  • width (length) -- width of the column. Default: shrink. See Plushie.Type.Length.
  • height (length) -- height of the column. Default: shrink.
  • max_width (number) -- maximum width in pixels.
  • align_x -- horizontal alignment of children: :left, :center, :right. See Plushie.Type.Alignment.
  • clip (boolean) -- clip children that overflow. Default: false.
  • wrap (boolean) -- wrap children to next column when they overflow. Default: false.
  • a11y (map) -- accessibility overrides. See Plushie.Type.A11y.

Summary

Functions

Sets accessibility annotations.

Sets the horizontal alignment of children.

Converts this column struct to a ui_node() map via the Plushie.Widget protocol.

Sets whether children that overflow are clipped.

Appends multiple children to the column.

Sets the column height.

Sets the maximum width in pixels.

Creates a new column struct with optional keyword opts.

Sets the padding inside the column.

Appends a child to the column.

Sets the spacing between children in pixels.

Sets the column width.

Applies keyword options to an existing column struct.

Sets whether children wrap to the next column on overflow.

Types

option()

@type option() ::
  {:spacing, number()}
  | {:padding, Plushie.Type.Padding.t()}
  | {:width, Plushie.Type.Length.t()}
  | {:height, Plushie.Type.Length.t()}
  | {:max_width, number()}
  | {:align_x, Plushie.Type.Alignment.t()}
  | {:clip, boolean()}
  | {:wrap, boolean()}
  | {:a11y, Plushie.Type.A11y.t() | map() | keyword()}

t()

@type t() :: %Plushie.Widget.Column{
  a11y: Plushie.Type.A11y.t() | nil,
  align_x: Plushie.Type.Alignment.t() | nil,
  children: [Plushie.Widget.child()],
  clip: boolean() | nil,
  height: Plushie.Type.Length.t() | nil,
  id: String.t(),
  max_width: number() | nil,
  padding: Plushie.Type.Padding.t() | nil,
  spacing: number() | nil,
  width: Plushie.Type.Length.t() | nil,
  wrap: boolean() | nil
}

Functions

a11y(col, a11y)

@spec a11y(column :: t(), a11y :: Plushie.Type.A11y.t() | map() | keyword()) :: t()

Sets accessibility annotations.

align_x(col, align_x)

@spec align_x(column :: t(), align_x :: Plushie.Type.Alignment.t()) :: t()

Sets the horizontal alignment of children.

build(col)

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

Converts this column struct to a ui_node() map via the Plushie.Widget protocol.

clip(col, clip)

@spec clip(column :: t(), clip :: boolean()) :: t()

Sets whether children that overflow are clipped.

extend(col, children)

@spec extend(column :: t(), children :: [Plushie.Widget.child()]) :: t()

Appends multiple children to the column.

height(col, height)

@spec height(column :: t(), height :: Plushie.Type.Length.t()) :: t()

Sets the column height.

max_width(col, max_width)

@spec max_width(column :: t(), max_width :: number()) :: t()

Sets the maximum width in pixels.

new(id, opts \\ [])

@spec new(id :: String.t(), opts :: [option()]) :: t()

Creates a new column struct with optional keyword opts.

padding(col, padding)

@spec padding(column :: t(), padding :: Plushie.Type.Padding.t()) :: t()

Sets the padding inside the column.

push(col, child)

@spec push(column :: t(), child :: Plushie.Widget.child()) :: t()

Appends a child to the column.

spacing(col, spacing)

@spec spacing(column :: t(), spacing :: number()) :: t()

Sets the spacing between children in pixels.

width(col, width)

@spec width(column :: t(), width :: Plushie.Type.Length.t()) :: t()

Sets the column width.

with_options(col, opts)

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

Applies keyword options to an existing column struct.

wrap(col, wrap)

@spec wrap(column :: t(), wrap :: boolean()) :: t()

Sets whether children wrap to the next column on overflow.