Icons

Add any icon library to a Ruby app. Support for Lucide, Phosphor, Heroicons and others

Installation

Add the core gem to your Gemfile:

gem "icons"

Then run:

bundle install

Usage

The core gem is designed to be configured by higher-level layers (as seen with rails_icons) but can be used directly if needed.

Example:

Icons.configure do |config|
  config.icons_path = "app/assets/svg/icons"
  config.default_library = :lucide
  config.default_variant = :outline
end

# Sync any library from their respective (GitHub) repository
Icons::Sync.new("lucide").now

# Render an icon
icon = Icons::Icon.new(name: "check", library: "lucide", variant: "outline", arguments: { class: "text-gray-500" })
svg = icon.svg

The resulting SVG will include the proper attributes and the SVG content from the library’s asset path.

First-party libraries

Libraries using Icons