# `Macaw.Component.Drawn`
[🔗](https://github.com/dcoai/macaw_component/blob/v0.1.3/lib/macaw/component/drawn.ex#L1)

Drawn states (spec/02 §6): every component is always in exactly one, in this precedence,
each but `live` with a theme role, a glyph and words, and never blank.

    iex> Macaw.Component.Drawn.pick([:stale, :loading])
    :loading
    iex> Macaw.Component.Drawn.role(:no_data)
    :neutral

# `t`

```elixir
@type t() ::
  :crashed | :down | :invalid | :loading | :no_data | :stale | :capped | :live
```

# `all`

```elixir
@spec all() :: [t(), ...]
```

The eight states, in precedence order.

# `glyph`

```elixir
@spec glyph(t()) :: atom() | nil
```

The glyph of the state's role's cue (`Macaw.Layers.Theme.cue/1`), `nil` for `live`.

# `pick`

```elixir
@spec pick([t()]) :: t()
```

The state of highest precedence among a list, `:live` for `[]`.

# `render`

```elixir
@spec render(t(), Macaw.Component.Context.t() | nil) :: Phoenix.HTML.safe()
```

A static notice for a state other than `live`: a paragraph with the state's class and
`data-mw-drawn`, a glyph element of the role's class hidden from assistive technology,
then the words. It is not a live region, so it holds in every mode. `live` is empty.

    iex> Macaw.Component.Drawn.render(:no_data, nil) |> Phoenix.HTML.safe_to_string()
    ~s(<p class="mw-drawn mw-drawn-no-data" data-mw-drawn="no_data"><span class="mw-glyph mw-glyph-diamond mw-role-neutral" aria-hidden="true"></span> No data</p>)

# `role`

```elixir
@spec role(t()) :: atom() | nil
```

The state's theme role, `nil` for `live`.

# `words`

```elixir
@spec words(t()) :: String.t() | nil
```

The state's words, `nil` for `live`.

---

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