Project

icons

0.0
A long-lived project that still receives updates
Add any icon library to a Ruby app, from Heroicons, to Lucide to Phosphor (and others). Icons is library-agnostic, so you can add any library while using the same interface.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

~> 1.16, >= 1.16.4
 Project Readme

Icons

Add any icon library to a Ruby app. Icons has first-party support for a dozen of libraries. It is library agnostic so it can be used with any icon library using the same interface.

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

Contributing

This project uses Standard for formatting Ruby code. Please make sure to run rake before submitting pull requests.

License

Icons is released under the MIT License.