rubicons

Rubicons is a Ruby gem that provides a collection of icons from various libraries. It is designed to be easy to use and integrate into your Ruby applications.

Gem Version

Installation

To install the rubicons gem, add this line to your application’s Gemfile:

gem 'rubicons'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install rubicons

Icons

The rubicons gem provides a collection of icons from various libraries. Below is a list of the available icon libraries along with their licenses, versions, and icon counts.

Icon Library License Version Count
Lucide ISC ed733916f30f34fb7815d76e286d9d097d73aa6b 1565
Radix Icons MIT bde33b13aa5848555f5512ac12155930fb4beb7d 318

I’ll create a comprehensive “How to Use” section for your README that covers both standalone and Rails Action View usage, including SVG examples for each icon library. Here’s how it could look:

How to Use

Standalone Usage

You can use Rubicons in any Ruby application without Rails. First, require the gem:

require 'rubicons'

Using Lucide Icons

# Get a simple 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

This generates an SVG element:





Using Radix Icons

# Get a simple icon with default options
svg = Rubicons::Radix.icon('heart')

# With custom size
svg = Rubicons::Radix.icon('heart', size: :xl)

# With custom class
svg = Rubicons::Radix.icon('heart', class: 'icon-primary')

# List all available icons
icon_names = Rubicons::Radix.available_icons

This generates an SVG element:





Rails Integration

Rubicons comes with Rails view helpers that make it easy to use icons in your views.

Setup

The helpers are automatically included in your ActionView context. You don’t need any additional setup beyond adding the gem to your Gemfile.

Using Lucide Icons in Views

<%# Basic icon %>
<%= lucide_icon('heart') %>

<%# With size options (xs, sm, md, lg, xl, 2xl) %>
<%= lucide_icon('heart', size: :lg) %>

<%# With custom class %>
<%= lucide_icon('heart', class: 'text-red-500 inline-block') %>

Using Radix Icons in Views

<%# Basic icon %>
<%= radix_icon('heart') %>

<%# With size options (xs, sm, md, lg, xl, 2xl) %>
<%= radix_icon('heart', size: :xl) %>

<%# With custom class %>
<%= radix_icon('heart', class: 'icon-primary inline-block') %>

Available Sizes

Both icon libraries support these predefined sizes:

Size Dimensions (pixels)
xs 12×12
sm 16×16
md 20×20 (default)
lg 24×24
xl 32×32
2xl 40×40

Icon Usage Examples

You can use these icons anywhere HTML is supported:

  <%= lucide_icon('save', size: :sm, class: 'mr-2') %>
  Save Changes


<div class="alert alert-info">
  &lt;%= radix_icon('info', size: :lg, class: 'align-middle') %&gt;
  <span>Please review the changes before continuing.</span>
</div>

For a complete list of available icons, visit:

Contributing

  1. Fork it ( https://github.com/insomnius/rubicons/fork )
  2. Create your feature branch (git checkout -b feature/my-new-feature)
  3. Commit your changes (git commit -am ‘Add some feature’)
  4. Push to the branch (git push origin feature/my-new-feature)
  5. Create a new Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.