# `ElementorexCms.Heroicons`
[🔗](https://github.com/rocket4ce/elementorex_cms/blob/v0.1.0/lib/elementorex_cms/heroicons.ex#L1)

[Heroicons](https://heroicons.com) v2.2 rendered as inline SVG.

The icons ship inside the package (`priv/heroicons/heroicons.json`, MIT, by
Tailwind Labs) in three styles: `"outline"` (24px, stroke), `"solid"` (24px)
and `"mini"` (20px). Rendering them inline instead of with the `hero-*`
classes of Phoenix's Tailwind plugin matters for a content editor: those
classes only exist for the icon names Tailwind finds in your source files,
while here the icon is picked at runtime.

    <ElementorexCms.Heroicons.icon name="gift" class="size-5" />
    <ElementorexCms.Heroicons.icon name="check-circle" style="solid" />

# `exists?`

```elixir
@spec exists?(term()) :: boolean()
```

Whether an icon with that name exists.

# `icon`

Renders an icon. Unknown names render nothing.

## Attributes

  * `name` - icon name, e.g. `"arrow-right"`
  * `style` - `"outline"` (default), `"solid"` or `"mini"`
  * `class` - classes for the `<svg>` (size it with `size-*` or CSS)
  * any other attribute is added to the `<svg>` (`aria-label`, `data-*`...)

## Attributes

* `name` (`:string`) (required)
* `style` (`:string`) - Defaults to `"outline"`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.

# `names`

```elixir
@spec names() :: [String.t()]
```

Names of every icon (the same in the three styles).

# `search`

```elixir
@spec search(String.t() | nil, pos_integer()) :: [String.t()]
```

Icons whose name (or a Spanish synonym) contains `query`, up to `limit`.
An empty query returns the first icons in alphabetical order.

# `styles`

```elixir
@spec styles() :: [String.t()]
```

Available styles: `"outline"`, `"solid"` and `"mini"`.

# `svg`

```elixir
@spec svg(String.t(), String.t(), keyword()) :: String.t()
```

The icon as an SVG string, for places that are not HEEx (the editor builds the
canvas document as a string).

---

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