
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Ruby on Rails views helper for the awesome heroicons by Steve Schoger. To see all the icons visit heroicons.
The latest version of this gem is built with heroicons v2.1.5 (316 icons).
This gem has no official affiliation with Tailwind Labs, yet.
Add this line to your application's Gemfile:
gem "rails_heroicon"
And then execute:
bundle install
Or install it yourself as:
gem install rails_heroicon
After installing the gem, call <%= heroicon "user" %>
on your erb
template.
The first argument is the icon name. All the icons are listed here.
This will generate the following html:
<svg
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
version="1.1"
>
<path
d="M16 7C16 9.20914 14.2091 11 12 11C9.79086 11 8 9.20914 8 7C8 4.79086 9.79086 3 12 3C14.2091 3 16 4.79086 16 7Z"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M12 14C8.13401 14 5 17.134 5 21H19C19 17.134 15.866 14 12 14Z"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
Note: Indentation is for readability purpose.
rails_heroicon
provides 4 variants, outline
, solid
, mini
, and micro
, outline
being
the default.
To change the variant <%= heroicon "user", variant: "solid" %>
.
Any html
and eruby
attribute is supported, for eg:
<%= heroicon "user", class: "text-gray-500", aria: { label: "user-icon" } %>
Normally, if you're just using vanilla heroicons with Tailwind CSS,
you'd add w-5 h-5
as classes on the svg element. With rails_heroicon
, you just
need to set the size
attribute on the helper method.
<%= heroicon "user", size: 20 %>
If the variant
is set as outline
or solid
, size
defaults to 24
,
if the variant
is set as mini
, size
defaults to 20
, and if the variant
is set as micro
, size
defaults to 16
. However, this can be over-written with
the size
attribute.
rails_heroicon
automatically sets aria-hidden="true"
if aria-label
is not
set, and if aria-label
is set, then role="img"
is set.
You can provide tooltips on hover if you pass in a title
option. Anything
passed into the title
option will be rendered inside of a
<title>
tag within the rendered SVG, which modern browsers will lean on to
display a tooltip on hover.
bundle install
, or run ./bin/setup
bundle exec rake
to run the tests to see if it passinggem build rails_heroicon.gemspec
gem push rails_heroicon-x.x.x.gem
Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
Please read the CONTRIBUTING.md on how to make pull requests.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Rails Heroicon project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that rails_heroicon demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.