Search documentation of Plushie

# Plushie.Widget.Column (Plushie v0.7.2)

Copy Markdown View Source

Column layout, arranges children vertically.

## Props

Name | Type | Default | Description
--- | --- | --- | ---
`spacing` | `number()` | `nil` | Vertical space between children in pixels. Default: 0.
`padding` | `number() | {number(), number()} | %Plushie.Type.Padding{}` | `nil` | Padding inside the column.
`width` | `:fill | :shrink | {:fill_portion, pos_integer()} | number()` | `nil` | Width of the column. Default: shrink.
`height` | `:fill | :shrink | {:fill_portion, pos_integer()} | number()` | `nil` | Height of the column. Default: shrink.
`max_width` | `number()` | `nil` | Maximum width in pixels.
`align_x` | `:left | :center | :right | :top | :bottom` | `nil` | Horizontal alignment of children: `:left`, `:center`, `:right`.
`clip` | `boolean()` | `nil` | Clip children that overflow. Default: false.
`wrap` | `boolean()` | `nil` | Wrap children to next column when they overflow. Default: false.
`event_rate` | `integer()` | `nil` | Max events per second for coalescable events.
`a11y` | `%Plushie.Type.A11y{} | map() | keyword()` | `nil` | Accessibility annotations.

## Summary

### Types

option()
t()

### Functions

a11y(widget, descriptor)

Accessibility annotations.

align_x(widget, descriptor)

Horizontal alignment of children: `:left`, `:center`, `:right`.

build(widget)

Converts this widget struct to a `ui_node()` map.

clip(widget, descriptor)

Clip children that overflow. Default: false.

column(id, opts \\ [])

Creates a `:column` widget.

event_rate(widget, descriptor)

Max events per second for coalescable events.

extend(widget, children)

Appends multiple children to the widget.

height(widget, descriptor)

Height of the column. Default: shrink.

max_width(widget, descriptor)

Maximum width in pixels.

new(id, opts \\ [])

Creates a new widget struct with the given ID and keyword options.

padding(widget, descriptor)

Padding inside the column.

push(widget, child)

Appends a child to the widget.

spacing(widget, descriptor)

Vertical space between children in pixels. Default: 0.

width(widget, descriptor)

Width of the column. Default: shrink.

with_options(widget, opts)

Applies keyword options to an existing widget struct.

wrap(widget, descriptor)

Wrap children to next column when they overflow. Default: false.

## Types

# option()

    @type option() ::
      (((((((({:spacing, number()}
              | {:padding,
                 number()
                 | {number(), number()}
                 | %Plushie.Type.Padding{
                     bottom: term(),
                     left: term(),
                     right: term(),
                     top: term()
                   }})
             | {:width, :fill | :shrink | {:fill_portion, pos_integer()} | number()})
            | {:height, :fill | :shrink | {:fill_portion, pos_integer()} | number()})
           | {:max_width, number()})
          | {:align_x, :left | :center | :right | :top | :bottom})
         | {:clip, boolean()})
        | {:wrap, boolean()})
       | {:event_rate, integer()})
      | {:a11y,
         %Plushie.Type.A11y{
           active_descendant: term(),
           busy: term(),
           described_by: term(),
           description: term(),
           disabled: term(),
           error_message: term(),
           expanded: term(),
           has_popup: term(),
           hidden: term(),
           invalid: term(),
           label: term(),
           label_from: term(),
           labelled_by: term(),
           level: term(),
           live: term(),
           mnemonic: term(),
           modal: term(),
           orientation: term(),
           position_in_set: term(),
           radio_group: term(),
           read_only: term(),
           required: term(),
           role: term(),
           selected: term(),
           size_of_set: term(),
           toggled: term(),
           value: term()
         }
         | map()
         | keyword()}

# t()

    @type t() :: %Plushie.Widget.Column{
      a11y:
        (%Plushie.Type.A11y{
           active_descendant: term(),
           busy: term(),
           described_by: term(),
           description: term(),
           disabled: term(),
           error_message: term(),
           expanded: term(),
           has_popup: term(),
           hidden: term(),
           invalid: term(),
           label: term(),
           label_from: term(),
           labelled_by: term(),
           level: term(),
           live: term(),
           mnemonic: term(),
           modal: term(),
           orientation: term(),
           position_in_set: term(),
           radio_group: term(),
           read_only: term(),
           required: term(),
           role: term(),
           selected: term(),
           size_of_set: term(),
           toggled: term(),
           value: term()
         }
         | map()
         | keyword())
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil,
      align_x:
        (:left | :center | :right | :top | :bottom)
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil,
      children: [Plushie.Widget.ui_node()],
      clip:
        boolean()
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil,
      event_rate:
        integer()
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil,
      height:
        (:fill | :shrink | {:fill_portion, pos_integer()} | number())
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil,
      id: String.t(),
      max_width:
        number()
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil,
      padding:
        (number()
         | {number(), number()}
         | %Plushie.Type.Padding{
             bottom: term(),
             left: term(),
             right: term(),
             top: term()
           })
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil,
      spacing:
        number()
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil,
      width:
        (:fill | :shrink | {:fill_portion, pos_integer()} | number())
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil,
      wrap:
        boolean()
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil
    }

## Functions

# a11y(widget, descriptor)

    @spec a11y(
      widget :: t(),
      value ::
        (%Plushie.Type.A11y{
           active_descendant: term(),
           busy: term(),
           described_by: term(),
           description: term(),
           disabled: term(),
           error_message: term(),
           expanded: term(),
           has_popup: term(),
           hidden: term(),
           invalid: term(),
           label: term(),
           label_from: term(),
           labelled_by: term(),
           level: term(),
           live: term(),
           mnemonic: term(),
           modal: term(),
           orientation: term(),
           position_in_set: term(),
           radio_group: term(),
           read_only: term(),
           required: term(),
           role: term(),
           selected: term(),
           size_of_set: term(),
           toggled: term(),
           value: term()
         }
         | map()
         | keyword())
        | nil
    ) :: t()

Accessibility annotations.

Accepts `%Plushie.Type.A11y{} | map() | keyword()`.

# align_x(widget, descriptor)

    @spec align_x(
      widget :: t(),
      value :: (:left | :center | :right | :top | :bottom) | nil
    ) :: t()

Horizontal alignment of children: `:left`, `:center`, `:right`.

Accepts `:left | :center | :right | :top | :bottom`.

# build(widget)

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

Converts this widget struct to a `ui_node()` map.

# clip(widget, descriptor)

    @spec clip(widget :: t(), value :: boolean() | nil) :: t()

Clip children that overflow. Default: false.

Accepts `boolean()`.

# column(id, opts \\ [])

(macro)

Creates a `:column` widget.

Shorthand for `new/2`. Import this macro to use the widget name directly in view functions:

    import Plushie.Widget.Column, only: [column: 2]

    column("my-id", prop: value)

# event_rate(widget, descriptor)

    @spec event_rate(widget :: t(), value :: integer() | nil) :: t()

Max events per second for coalescable events.

Accepts `integer()`.

# extend(widget, children)

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

Appends multiple children to the widget.

# height(widget, descriptor)

    @spec height(
      widget :: t(),
      value :: (:fill | :shrink | {:fill_portion, pos_integer()} | number()) | nil
    ) :: t()

Height of the column. Default: shrink.

Accepts `:fill | :shrink | {:fill_portion, pos_integer()} | number()`.

# max_width(widget, descriptor)

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

Maximum width in pixels.

Accepts `number()`.

# new(id, opts \\ [])

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

Creates a new widget struct with the given ID and keyword options.

# padding(widget, descriptor)

    @spec padding(
      widget :: t(),
      value ::
        (number()
         | {number(), number()}
         | %Plushie.Type.Padding{
             bottom: term(),
             left: term(),
             right: term(),
             top: term()
           })
        | nil
    ) :: t()

Padding inside the column.

Accepts `number() | {number(), number()} | %Plushie.Type.Padding{}`.

# push(widget, child)

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

Appends a child to the widget.

# spacing(widget, descriptor)

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

Vertical space between children in pixels. Default: 0.

Accepts `number()`.

# width(widget, descriptor)

    @spec width(
      widget :: t(),
      value :: (:fill | :shrink | {:fill_portion, pos_integer()} | number()) | nil
    ) ::
      t()

Width of the column. Default: shrink.

Accepts `:fill | :shrink | {:fill_portion, pos_integer()} | number()`.

# with_options(widget, opts)

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

Applies keyword options to an existing widget struct.

# wrap(widget, descriptor)

    @spec wrap(widget :: t(), value :: boolean() | nil) :: t()

Wrap children to next column when they overflow. Default: false.

Accepts `boolean()`.