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.
Add the core gem to your Gemfile:
gem "icons"Then run:
bundle installThe 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.svgThe resulting SVG will include the proper attributes and the SVG content from the library’s asset path.
- Boxicons (1600+ icons)
- Feather (280+ icons)
- Flags (540+ icons)
- Heroicons (300+ icons)
- Linear (170+ icons)
- Lucide (1500+ icons)
- Phosphor (9000+ icons)
- Radix (300+ icons)
- SidekickIcons (49 icons, complementing Heroicons)
- Tabler (5700+ icons)
- Weather (215+ icons)
This project uses Standard for formatting Ruby code. Please make sure to run rake before submitting pull requests.
Icons is released under the MIT License.