Guide

# Custom libraries

First-class components for your own icon sets.

## Register a library

```ruby
Glyphs.register_library(:brand, component: :BrandIcon)
```

```ruby
BrandIcon(:logo, class: "size-6")
```

`register_library` defines `Glyphs::BrandIcon < Glyphs::Icon` and the kit picks the constant up automatically — the `BrandIcon(...)` method exists everywhere `Glyphs` is included. Registration is idempotent; re-registering the same component for a *different* library raises.

## Where the SVGs come from

glyphs resolves files through the `icons` gem, so a custom library's location is configured there (rails_icons custom-library config), not in glyphs. Add validation for it in `.rubocop.yml` if you want lint-time checking:

```yaml
Glyphs/IconResolution:
  Libraries:
    BrandIcon: { Dir: brand, DefaultVariant: "" }
```