Add Flags Icons to your Ruby on Rails App

Rails Icons is a library-agnostic Rails gem with support for Flags. Icons are sourced from the Flags GitHub repo. Use any of the 540+ icons in your app.

Install

Add the rails_icons gem:

bundle add rails_icons

Install, by creating the initializer and sync the available nl icons.

rails generate rails_icons:install --libraries=flags

Usage

icon "nl"

# Add CSS
icon "nl", class: "text-green-500"

# Add data attributes
icon "nl", data: { controller: "swap" }

Sync icons

If Flags gets updated, sync the icons with

rails generate rails_icons:sync
Learn more at the Rails Icons page.