2021-03-03 17:35:03 -05:00
# Heroicons
2022-09-21 14:14:58 +10:00
[Heroicons ](https://heroicons.com ) are "a set of free MIT-licensed high-quality SVG icons for you to use in your web projects". This package gives you Elixir functions to drop Heroicons into your HTML, styled with arbitrary classes.
2021-03-03 17:35:03 -05:00
2022-09-15 11:58:46 -04:00
This library provides optimized svgs for each Heroicon packaged as a Phoenix Component.
2022-09-02 13:49:03 -04:00
2021-03-06 17:10:54 -05:00
Heroicons are designed by [Steve Schoger ](https://twitter.com/steveschoger )
2022-09-20 13:38:29 -04:00
Current Heroicons Version: **2.0.11** .
2022-02-21 12:02:04 -05:00
2021-03-06 17:10:54 -05:00
## Installation
Add Heroicons to your `mix.exs` :
2021-11-12 12:08:11 -05:00
```elixir
2021-03-06 17:10:54 -05:00
defp deps do
[
2022-09-15 11:58:46 -04:00
{:heroicons, "~> 0.5.0"}
2021-03-06 17:10:54 -05:00
]
end
2021-11-12 12:08:11 -05:00
```
2021-03-06 17:10:54 -05:00
After that, run `mix deps.get` .
## Usage
2022-09-20 12:08:23 -04:00
The components are provided by the `Heroicons` module. Each icon is a Phoenix Component you can use in your HEEx templates.
2022-09-15 11:58:46 -04:00
2022-09-20 12:07:54 -04:00
By default the outline style is used:
2021-03-06 17:10:54 -05:00
```eex
2021-11-12 12:08:11 -05:00
< Heroicons.Solid.cake / >
2021-03-06 17:10:54 -05:00
```
2022-09-15 11:58:46 -04:00
You can render the solid or mini styles by providing the `solid` or `mini` flags:
2021-03-06 17:10:54 -05:00
```eex
2022-09-15 11:58:46 -04:00
< Heroicons.Solid.cake solid / >
< Heroicons.Solid.cake mini / >
2021-03-06 17:10:54 -05:00
```
2022-09-15 11:58:46 -04:00
You can also provide arbitrary HTML attributes to the svg tag, such as classes:
2021-03-10 14:30:12 -05:00
2022-09-15 11:58:46 -04:00
```eex
< Heroicons.cake class = "w-6 h-6 text-gray-500" / >
2021-03-10 14:30:12 -05:00
```
2021-03-06 17:10:54 -05:00
For a full list of icons see [the docs ](https://hexdocs.pm/heroicons/api-reference.html ) or [heroicons.com ](https://heroicons.com/ ).