Ruby on Rails view helpers for the beautiful hand-crafted SVG icons, Heroicons.
Used in production at Morning Brew ☕
This gem has no official affiliation with Tailwind CSS or the Heroicon team (yet!). Check out their sites:
Add this line to your application's Gemfile:
gem "heroicon"
And then execute:
$ bundle
Run the installer
$ rails g heroicon:install
To use a icon in your views, simply use the provided view helper with the name of an icon.
<%= heroicon "search" %>
Heroicon comes with two variants, :outline
and :solid
. The default variant is :solid
. This can be changed in config/initializers/heroicon.rb
, which is generated during installation. To overwrite this in the view, use
<%= heroicon "search", variant: :outline %>
You can also pass HTML options directly to the icon.
<%= heroicon "search", options: { class: "text-primary-500" } %>
Heroicon currently supports icons up to Version 1.0.1
. If there is a icon that is missing, feel free to contribute by following our contributing guide below.
Anyone is encouraged to help improve this project. Here are a few ways you can help:
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features
To get started with development:
git clone https://github.com/bharget/heroicon.git
cd heroicon
bundle install
bundle exec rake test
The gem is available as open source under the terms of the MIT License.