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

Pointer area, captures mouse events on child content.

Wraps child content and emits click events for various mouse buttons,
hover enter/exit, cursor movement, scroll, and double-click events.
Optionally sets the mouse cursor when hovering the area.

## Props

| Name | Type | Default | Description |
|------|------|---------|-------------|
| `cursor` | `atom()` | `nil` | Mouse cursor to show on hover (e.g. `:pointer`, `:grab`). |
| `on_press` | `String.t() \| atom()` | `nil` | Event tag for left mouse press events. |
| `on_release` | `String.t() \| atom()` | `nil` | Event tag for left mouse release events. |
| `on_right_press` | `boolean()` | `nil` | Enable right mouse press events. |
| `on_right_release` | `boolean()` | `nil` | Enable right mouse release events. |
| `on_middle_press` | `boolean()` | `nil` | Enable middle mouse press events. |
| `on_middle_release` | `boolean()` | `nil` | Enable middle mouse release events. |
| `on_double_click` | `boolean()` | `nil` | Enable double-click events. |
| `on_enter` | `boolean()` | `nil` | Enable cursor enter events. |
| `on_exit` | `boolean()` | `nil` | Enable cursor exit events. |
| `on_move` | `boolean()` | `nil` | Enable cursor move events. |
| `on_scroll` | `boolean()` | `nil` | Enable scroll wheel events. |
| `event_rate` | `integer()` | `nil` | Max events per second for coalescable events. |
| `a11y` | `%Plushie.Type.A11y{} \| map() \| keyword()` | `nil` | Accessibility annotations. |

# `option`

```elixir
@type option() ::
  (((((((((((({:cursor, atom()} | {:on_press, String.t() | atom()})
             | {:on_release, String.t() | atom()})
            | {:on_right_press, boolean()})
           | {:on_right_release, boolean()})
          | {:on_middle_press, boolean()})
         | {:on_middle_release, boolean()})
        | {:on_double_click, boolean()})
       | {:on_enter, boolean()})
      | {:on_exit, boolean()})
     | {:on_move, boolean()})
    | {:on_scroll, 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`

```elixir
@type t() :: %Plushie.Widget.PointerArea{
  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,
  children: [Plushie.Widget.ui_node()],
  cursor:
    atom()
    | 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,
  id: String.t(),
  on_double_click:
    boolean()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  on_enter:
    boolean()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  on_exit:
    boolean()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  on_middle_press:
    boolean()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  on_middle_release:
    boolean()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  on_move:
    boolean()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  on_press:
    (String.t() | atom())
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  on_release:
    (String.t() | atom())
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  on_right_press:
    boolean()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  on_right_release:
    boolean()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  on_scroll:
    boolean()
    | 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()`.

# `build`

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

Converts this widget struct to a `ui_node()` map. Validates at most one child.

# `cursor`

```elixir
@spec cursor(widget :: t(), value :: atom() | nil) :: t()
```

Mouse cursor to show on hover (e.g. `:pointer`, `:grab`).

Accepts `atom()`.

# `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.

# `new`

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

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

# `on_double_click`

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

Enable double-click events.

Accepts `boolean()`.

# `on_enter`

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

Enable cursor enter events.

Accepts `boolean()`.

# `on_exit`

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

Enable cursor exit events.

Accepts `boolean()`.

# `on_middle_press`

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

Enable middle mouse press events.

Accepts `boolean()`.

# `on_middle_release`

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

Enable middle mouse release events.

Accepts `boolean()`.

# `on_move`

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

Enable cursor move events.

Accepts `boolean()`.

# `on_press`

```elixir
@spec on_press(widget :: t(), value :: (String.t() | atom()) | nil) :: t()
```

Event tag for left mouse press events.

Accepts `String.t() | atom()`.

# `on_release`

```elixir
@spec on_release(widget :: t(), value :: (String.t() | atom()) | nil) :: t()
```

Event tag for left mouse release events.

Accepts `String.t() | atom()`.

# `on_right_press`

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

Enable right mouse press events.

Accepts `boolean()`.

# `on_right_release`

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

Enable right mouse release events.

Accepts `boolean()`.

# `on_scroll`

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

Enable scroll wheel events.

Accepts `boolean()`.

# `pointer_area`
*macro* 

Creates a `:pointer_area` widget.

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

    import Plushie.Widget.PointerArea, only: [pointer_area: 2]

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

# `push`

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

Appends a child to the widget.

# `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*
