Ruby on Rails view helpers for rendering SVG icons from any GitHub collection.
One helper, thousands of icons, zero JavaScript.
One helper method. Pass the icon name, get an SVG. No asset pipeline configuration needed.
Font Awesome, Heroicons, Tabler, Carbon, Ionicons, Feather, and more. All built-in.
Icons are downloaded from GitHub on first use and cached locally. No manual downloads.
Pass any HTML attribute: class, id, fill, width, height, data-*, aria-*, and more.
SVG attribute allowlist, path traversal protection, SSRF prevention with host validation.
Add any GitHub-hosted icon collection with a simple configuration block.
Just call the helper in your views.
<%# Positional argument %> <%= anyicon "heroicons_outline:check" %> <%# Keyword argument %> <%= anyicon icon: "fontawesome_solid:star" %> <%# With HTML attributes %> <%= anyicon "tabler_icons_outline:heart", class: "w-6 h-6", fill: "red", id: "fav-icon" %> <%# Stimulus & accessibility %> <%= anyicon "ionicons:heart", "data-controller": "icon", "aria-label": "Favorite", role: "img" %>
From helper call to rendered SVG in milliseconds.
Use anyicon "collection:icon_name" in any view, partial, or layout.
If the icon isn't cached locally, Anyicon downloads the SVG from the configured GitHub repo.
The SVG is saved to app/assets/images/icons/ and rendered inline with your custom attributes.
Works out of the box, but fully configurable.
Anyicon.configure do |config| # Add your own collections config.add_collections( my_icons: { repo: "user/repo", path: "path/to/icons", branch: "main" } ) # Optional: GitHub token for higher API rate limits # (60/hour without vs 5,000/hour with token) config.github_token = ENV["GITHUB_TOKEN"] end
12,000+ icons ready to use. Just reference them by name.
fontawesome_regular
fontawesome_solid
fontawesome_brands
heroicons_outline
heroicons_solid
tabler_icons_filled
tabler_icons_outline
mage_icons_fill
mage_icons_stroke
mage_icons_social_bw
mage_icons_social_color
line_awesome
carbon
ionicons
feather_icons
Up and running in 30 seconds.
# Add to your Gemfile $ bundle add anyicon # Or generate the initializer $ rails generate anyicon:install # Use in any view <%= anyicon "heroicons_outline:check", class: "w-5 h-5" %>