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

Horizontal or vertical rule (divider line).

## Props

| Name | Type | Default | Description |
|------|------|---------|-------------|
| `height` | `number()` | `nil` | Line thickness in pixels (for horizontal rules). |
| `width` | `number()` | `nil` | Line thickness in pixels (for vertical rules). |
| `thickness` | `number()` | `nil` | Direction-agnostic line thickness in pixels. Used when the direction-specific width/height isn't set. |
| `direction` | `:horizontal \| :vertical \| :both` | `nil` | `:horizontal` (default) or `:vertical`. |
| `style` | `:default
\| :primary
\| :secondary
\| :success
\| :danger
\| :warning
\| :dark
\| :weak
\| :rounded_box
\| term()` | `nil` | Named preset or custom `StyleMap`. |
| `event_rate` | `integer()` | `nil` | Max events per second for coalescable events. |
| `a11y` | `%Plushie.Type.A11y{} \| map() \| keyword()` | `%{role: :splitter}` | Accessibility annotations. |

# `option`

```elixir
@type option() ::
  ((((({:height, number()} | {:width, number()}) | {:thickness, number()})
     | {:direction, :horizontal | :vertical | :both})
    | {:style,
       :default
       | :primary
       | :secondary
       | :success
       | :danger
       | :warning
       | :dark
       | :weak
       | :rounded_box
       | term()})
   | {: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.Rule{
  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,
  direction:
    (:horizontal | :vertical | :both)
    | 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:
    number()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  id: String.t(),
  style:
    (:default
     | :primary
     | :secondary
     | :success
     | :danger
     | :warning
     | :dark
     | :weak
     | :rounded_box
     | term())
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  thickness:
    number()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  width:
    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()`.

# `build`

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

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

# `direction`

```elixir
@spec direction(widget :: t(), value :: (:horizontal | :vertical | :both) | nil) ::
  t()
```

`:horizontal` (default) or `:vertical`.

Accepts `:horizontal | :vertical | :both`.

# `event_rate`

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

Max events per second for coalescable events.

Accepts `integer()`.

# `height`

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

Line thickness in pixels (for horizontal rules).

Accepts `number()`.

# `new`

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

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

# `rule`
*macro* 

Creates a `:rule` widget.

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

    import Plushie.Widget.Rule, only: [rule: 2]

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

# `style`

```elixir
@spec style(
  widget :: t(),
  value ::
    (:default
     | :primary
     | :secondary
     | :success
     | :danger
     | :warning
     | :dark
     | :weak
     | :rounded_box
     | term())
    | nil
) :: t()
```

Named preset or custom `StyleMap`.

Accepts `:default
| :primary
| :secondary
| :success
| :danger
| :warning
| :dark
| :weak
| :rounded_box
| term()`.

# `thickness`

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

Direction-agnostic line thickness in pixels. Used when the direction-specific width/height isn't set.

Accepts `number()`.

# `width`

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

Line thickness in pixels (for vertical rules).

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