Components
One component per rails_icons library, all subclasses of Glyphs::Icon.
Library components#
| Component | rails_icons library |
|---|---|
LucideIcon | lucide |
PhosphorIcon | phosphor |
HeroIcon | heroicons |
TablerIcon | tabler |
FeatherIcon | feather |
BoxIcon | boxicons |
FlagIcon | flags |
HugeIcon | hugeicons |
LinearIcon | linear |
RadixIcon | radix |
SidekickIcon | sidekickicons |
WeatherIcon | weather |
AnimatedIcon | animated |
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.