Rubicons is a lightweight, pure Ruby SVG icon toolkit inspired by React Icons. It provides a simple and consistent way to include beautiful SVG icons in your Ruby and Rails applications without external dependencies.
- Pure Ruby implementation - no JavaScript dependencies
- SVG-based icons - scalable without quality loss
- Multiple icon libraries - access thousands of icons from popular icon sets
- Rails integration - seamlessly works with Rails via helper methods
- Customizable - easily change size, color, and add CSS classes
Add this line to your application's Gemfile:
gem 'rubicons'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install rubicons
Rubicons provides access to 23 popular icon libraries with thousands of icons:
Icon Library | Version | License | Count | Example Icons |
---|---|---|---|---|
Bootstrap | v1.11.3 | MIT | 2,050 | alarm , heart , calendar , circle , house |
Box Icons | Latest | MIT/CC 4.0 | 1,634 | bx-home , bx-search , bx-menu , bx-user , bxl-github |
Circum Icons | Latest | MPL-2.0 | 288 | alarm-on , align-center-h , arrow , check , user |
Devicon | v2.16.0 | MIT | 1520 | aarch64-line.svg , aarch64-original.svg , aarch64-plain.svg , adonisjs-original-wordmark.svg , adonisjs-original.svg |
Feather | v4.29.1 | MIT | 287 | activity , alert-circle , airplay , message-square , star |
Font Awesome 5 | v5.15.4 | Multiple | 1,612 | brands-github , solid-user , regular-heart , solid-home , solid-star |
Font Awesome 6 | v6.5.2 | Multiple | 2,045 | brands-github , solid-user , solid-house , solid-flag , solid-shield |
Heroicons v1 | v1.0.6 | MIT | 460 | outline-academic-cap , outline-archive , solid-home , outline-menu , solid-user |
Heroicons v2 | v2.1.3 | MIT | 1,176 | 16-solid-academic-cap , 24-outline-home , 24-solid-user , 20-solid-calendar , 16-outline-bell |
Ionicons 4 | v4.6.4-1 | MIT | 696 | ios-add , ios-alarm , ios-home , md-mail , md-menu |
Ionicons 5 | v5.5.4 | MIT | 1,332 | accessibility , add-circle , home , mail , menu |
Line Awesome | Latest | MIT/Good Boy | 1,544 | 500px , accessible-icon , github , user-solid , heart |
Lucide | Latest | ISC | 1,565 | heart , activity , book , check , user |
Material Design | v4.0.0 | Apache 2.0 | 6862 | action-3d-rotation , action-accessibility , action-account-circle , content-home , action-settings |
Octicons | v18.3.0 | MIT | 576 | accessibility-16 , alert-16 , check-16 , code-16 , mark-github-16 |
Phosphor Icons | Latest | MIT | 9,072 | acorn-bold , user-bold , heart-fill , house-line , calendar |
Radix UI | Latest | MIT | 318 | accessibility , activity-log , align-bottom , align-center-horizontally , bookmark |
Remix Icon | v4.2.0 | Apache 2.0 | 2,860 | arrow-down-circle-fill , home-line , user-fill , search-line , check-line |
Tabler Icons | v3.31.0 | MIT | 5,880 | filled-accessible , filled-home , filled-user , filled-search , brand-github |
Themify | v1.0.1 | SIL OFL/MIT | 352 | angle-down , agenda , alarm-clock , alert , align-center |
Typicons | v2.1.2 | SIL OFL | 336 | anchor , adjust-brightness , adjust-contrast , archive , heart |
Weather Icons | v2.0.12 | SIL OFL 1.1 | 219 | wi-alien , wi-barometer , wi-celsius , wi-cloud-refresh , wi-cloud-down |
You can use Rubicons in any Ruby application without Rails. First, require the gem:
require 'rubicons'
Then use any of the icon libraries:
# Get an icon with default options (medium size)
svg = Rubicons::Lucide.icon('heart')
# With custom size
svg = Rubicons::Lucide.icon('heart', size: :lg)
# With custom class
svg = Rubicons::Lucide.icon('heart', class: 'text-red-500')
# List all available icons
icon_names = Rubicons::Lucide.available_icons
# Get an icon with default options
svg = Rubicons::Bootstrap.icon('heart-fill')
# With custom size
svg = Rubicons::Bootstrap.icon('heart-fill', size: :xl)
# With custom class
svg = Rubicons::Bootstrap.icon('heart-fill', class: 'text-danger')
# Font Awesome 5
svg = Rubicons::FontAwesome5.icon('solid-paper-plane')
# Font Awesome 6
svg = Rubicons::FontAwesome6.icon('solid-user-nurse')
# Heroicons v1
svg = Rubicons::Heroicons.icon('outline-folder-remove')
# Heroicons v2
svg = Rubicons::Heroicons2.icon('16-solid-tv')
In a Rails application, Rubicons automatically integrates with ActionView to provide helper methods for each icon library:
<%# Lucide Icons %>
<%= lucide_icon 'heart', class: 'text-red-500', size: :lg %>
<%# Radix Icons %>
<%= radix_icon 'heart', class: 'icon-primary' %>
<%# Bootstrap Icons %>
<%= bootstrap_icon 'heart-fill', class: 'text-danger' %>
<%# Box Icons %>
<%= box_icon 'bx-home' %>
<%# Font Awesome 5 %>
<%= fa5_icon 'solid-paper-plane', size: :xl %>
<%# Font Awesome 6 %>
<%= fa6_icon 'solid-user-nurse' %>
<%# Heroicons v1 %>
<%= heroicon 'outline-folder-remove' %>
<%# Heroicons v2 %>
<%= heroicon2 '16-solid-tv' %>
<%# Circum Icons %>
<%= circum_icon 'arrow' %>
<%# Feather Icons %>
<%= feather_icon 'activity' %>
<%# Ionicons 4 %>
<%= ion4_icon 'home' %>
All icons support the following size options:
Size | Dimensions |
---|---|
:xs |
12×12 |
:sm |
16×16 |
:md |
20×20 (default) |
:lg |
24×24 |
:xl |
32×32 |
:2xl |
40×40 |
Bug reports and pull requests are welcome on GitHub at https://github.com/insomnius/rubicons.
Code of conduct is based on the Contributor Covenant, version 2.0. Please read it to understand our expectations for participants.
The gem is available as open source under the terms of the MIT License.