# `Plushie.Widget.Overlay`
[🔗](https://github.com/plushie-ui/plushie-elixir/blob/v0.7.2/lib/plushie/widget/overlay.ex#L22)

Overlay container, positions the second child as a floating overlay
relative to the first child (anchor).

Exactly two children are required:
1. The anchor widget (rendered inline in the layout).
2. The overlay content (rendered as a floating overlay above everything else).

## Props

| Name | Type | Default | Description |
|------|------|---------|-------------|
| `position` | `:below \| :above \| :left \| :right` | `nil` | Overlay position: `:below`, `:above`, `:left`, `:right`. |
| `gap` | `number()` | `nil` | Space between anchor and overlay in pixels. Default: 0. |
| `offset_x` | `number()` | `nil` | Horizontal offset in pixels after positioning. |
| `offset_y` | `number()` | `nil` | Vertical offset in pixels after positioning. |
| `flip` | `boolean()` | `nil` | Auto-flip when content overflows viewport. Default: false. |
| `align` | `:start \| :center \| :end` | `nil` | Cross-axis alignment relative to anchor: `:start`, `:center`, `:end`. |
| `width` | `:fill \| :shrink \| {:fill_portion, pos_integer()} \| number()` | `nil` | Width of the overlay node. |
| `event_rate` | `integer()` | `nil` | Max events per second for coalescable events. |
| `a11y` | `%Plushie.Type.A11y{} \| map() \| keyword()` | `nil` | Accessibility annotations. |

# `option`

```elixir
@type option() ::
  ((((((({:position, :below | :above | :left | :right} | {:gap, number()})
        | {:offset_x, number()})
       | {:offset_y, number()})
      | {:flip, boolean()})
     | {:align, :start | :center | :end})
    | {:width, :fill | :shrink | {:fill_portion, pos_integer()} | number()})
   | {: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`

```elixir
@type t() :: %Plushie.Widget.Overlay{
  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:
    (:start | :center | :end)
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  children: [Plushie.Widget.ui_node()],
  event_rate:
    integer()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  flip:
    boolean()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  gap:
    number()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  id: String.t(),
  offset_x:
    number()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  offset_y:
    number()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  position:
    (:below | :above | :left | :right)
    | 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
}
```

# `a11y`

```elixir
@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`

```elixir
@spec align(widget :: t(), value :: (:start | :center | :end) | nil) :: t()
```

Cross-axis alignment relative to anchor: `:start`, `:center`, `:end`.

Accepts `:start | :center | :end`.

# `build`

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

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

# `event_rate`

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

Max events per second for coalescable events.

Accepts `integer()`.

# `extend`

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

Appends multiple children to the widget.

# `flip`

```elixir
@spec flip(widget :: t(), value :: boolean() | nil) :: t()
```

Auto-flip when content overflows viewport. Default: false.

Accepts `boolean()`.

# `gap`

```elixir
@spec gap(widget :: t(), value :: number() | nil) :: t()
```

Space between anchor and overlay in pixels. Default: 0.

Accepts `number()`.

# `new`

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

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

# `offset_x`

```elixir
@spec offset_x(widget :: t(), value :: number() | nil) :: t()
```

Horizontal offset in pixels after positioning.

Accepts `number()`.

# `offset_y`

```elixir
@spec offset_y(widget :: t(), value :: number() | nil) :: t()
```

Vertical offset in pixels after positioning.

Accepts `number()`.

# `overlay`
*macro* 

Creates a `:overlay` widget.

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

    import Plushie.Widget.Overlay, only: [overlay: 2]

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

# `position`

```elixir
@spec position(widget :: t(), value :: (:below | :above | :left | :right) | nil) ::
  t()
```

Overlay position: `:below`, `:above`, `:left`, `:right`.

Accepts `:below | :above | :left | :right`.

# `push`

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

Appends a child to the widget.

# `width`

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

Width of the overlay node.

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

# `with_options`

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

Applies keyword options to an existing widget struct.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
