Rails Icons

A Ruby on Rails OSS gem to add SVG icons from multiple libraries (Heroicons, Feather Icons and Lucide icons), or your own custom icon set with this one gem.

Install

Add this line to your Gemfile:

gem "rails_icons"

And run:

bundle

Usage

# The default library is Heroicons, with "outline" as the default set
icon "check"

# Use another set (options are: outline, solid, mini, micro)
icon "check", set: "solid"

# Add CSS to the icon
icon "check", class: "text-green-500"

# Add data attributes
icon "check", data: { controller: "swap" }

# Tweak the stroke-width
icon "check", stroke_width: 2

Change the defaults by creating an initializer: rails generate rails_icons:initializer.