Rails Icons

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

Install

Add this line to your Gemfile:

gem "rails_icons"

And run:

bundle

Create the initializer

rails generate rails_icons:initializer

Sync any of the supported icon libraries from the rails_icons_vault:

rails generate rails_icons:sync heroicons

Usage

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

# Use another set (options, for Heroicons, 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