Skip to content

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

Notifications You must be signed in to change notification settings

Rails-Designer/icons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Topics

Resources

Stars

Watchers

Forks