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
- 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)