Plushie.Widget.Row (Plushie v0.6.0)

Copy Markdown View Source

Row layout -- arranges children horizontally.

Props

  • spacing (number) -- horizontal space between children in pixels. Default: 0.
  • padding (number | map) -- padding inside the row. See Plushie.Type.Padding.

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

Summary

Functions

Sets accessibility annotations.

Sets the vertical alignment of children.

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

Sets whether children that overflow are clipped.

Appends multiple children to the row.

Sets the row height.

Sets the maximum width of the row in pixels.

Creates a new row struct with optional keyword opts.

Sets the padding inside the row.

Appends a child to the row.

Sets the spacing between children in pixels.

Sets the row width.

Applies keyword options to an existing row struct.

Sets whether children wrap to the next row on overflow.

Types

option()

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

t()

@type t() :: %Plushie.Widget.Row{
  a11y: Plushie.Type.A11y.t() | nil,
  align_y: 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(row, a11y)

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

Sets accessibility annotations.

align_y(row, align_y)

@spec align_y(row :: t(), align_y :: Plushie.Type.Alignment.t()) :: t()

Sets the vertical alignment of children.

build(row)

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

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

clip(row, clip)

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

Sets whether children that overflow are clipped.

extend(row, children)

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

Appends multiple children to the row.

height(row, height)

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

Sets the row height.

max_width(row, max_width)

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

Sets the maximum width of the row in pixels.

new(id, opts \\ [])

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

Creates a new row struct with optional keyword opts.

padding(row, padding)

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

Sets the padding inside the row.

push(row, child)

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

Appends a child to the row.

spacing(row, spacing)

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

Sets the spacing between children in pixels.

width(row, width)

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

Sets the row width.

with_options(row, opts)

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

Applies keyword options to an existing row struct.

wrap(row, wrap)

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

Sets whether children wrap to the next row on overflow.