Guide

Components

One component per rails_icons library, all subclasses of Glyphs::Icon.

Library components#

Componentrails_icons library
LucideIconlucide
PhosphorIconphosphor
HeroIconheroicons
TablerIcontabler
FeatherIconfeather
BoxIconboxicons
FlagIconflags
HugeIconhugeicons
LinearIconlinear
RadixIconradix
SidekickIconsidekickicons
WeatherIconweather
AnimatedIconanimated

AnimatedIcon renders the spinners bundled inside the icons gem itself (faded-spinner, trailing-spinner, fading-dots, bouncing-dots) — nothing to sync.

Kit mechanics#

Each component is a tiny Glyphs::Icon subclass that pins its library. Because Glyphs extends Phlex::Kit, including it gives you the capitalized call form; outside a kit context, instantiate directly:

# Inside a component that includes Glyphs:
LucideIcon(:house, class: "size-4")

# Anywhere else:
render Glyphs::LucideIcon.new(:house, class: "size-4")
Glyphs::LucideIcon.new(:house).call # => "<svg ...>" (standalone string)

Rendered SVGs are memoized in a bounded LRU cache (config.svg_cache_size, 1024 by default, one per Ractor), keyed on [library, variant, name] and whether data: is given. Each call's attributes are applied to the cached markup, so repeated renders of an icon skip the file read and Nokogiri parse whatever their class: or id:. Attributes the icons gem writes specially (HTML boolean attributes, href/src/action, control characters) render uncached. Disable with config.cache_svgs = false.