# lab2023/heroicons-rails architecture

> Architecture diagram of the GitHub repository lab2023/heroicons-rails, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lab2023/heroicons-rails
- Repository: https://github.com/lab2023/heroicons-rails

## Overview

Heroicons::Rails is a small Rails view integration for rendering Heroicons SVGs. A view calls `icon_tag`; the helper applies configured defaults, searches application icons before bundled icons, and returns SVG markup. The gem also supports custom application icons and an install generator for creating a configuration initializer. The main rendering and configuration paths are supported by sampled source; icon-type and custom-icon capabilities are documented in the README.

Main entry points: [`app/helpers/heroicons/application_helper.rb`](https://github.com/lab2023/heroicons-rails/blob/develop/app/helpers/heroicons/application_helper.rb) (Icon helper), [`lib/heroicons/engine.rb`](https://github.com/lab2023/heroicons-rails/blob/develop/lib/heroicons/engine.rb) (Rails engine), [`lib/generators/heroicons/install_generator.rb`](https://github.com/lab2023/heroicons-rails/blob/develop/lib/generators/heroicons/install_generator.rb) (Install generator), [`lib/heroicons/configuration.rb`](https://github.com/lab2023/heroicons-rails/blob/develop/lib/heroicons/configuration.rb) (Configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_view(("Rails view"))
node_engine["Rails engine<br/>[engine.rb]"]
node_helper["Icon helper"]
node_configuration["Configuration<br/>[configuration.rb]"]
node_app_icons["Application icons"]
node_bundled_icons["Bundled icons"]
node_generator["Install generator"]
node_initializer_template["Initializer template<br/>[initializer.rb]"]

node_engine -->|"includes on load"| node_helper
node_view -->|"calls icon_tag"| node_helper
node_helper -->|"reads defaults"| node_configuration
node_helper -->|"searches first"| node_app_icons
node_helper -->|"searches fallback"| node_bundled_icons
node_helper -->|"returns SVG"| node_view
node_generator -->|"copies template"| node_initializer_template

click node_engine "https://github.com/lab2023/heroicons-rails/blob/develop/lib/heroicons/engine.rb"
click node_helper "https://github.com/lab2023/heroicons-rails/blob/develop/app/helpers/heroicons/application_helper.rb"
click node_configuration "https://github.com/lab2023/heroicons-rails/blob/develop/lib/heroicons/configuration.rb"
click node_app_icons "https://github.com/lab2023/heroicons-rails/tree/develop/app/assets/images/icons"
click node_bundled_icons "https://github.com/lab2023/heroicons-rails/tree/develop/app/assets/images/icons"
click node_generator "https://github.com/lab2023/heroicons-rails/blob/develop/lib/generators/heroicons/install_generator.rb"
click node_initializer_template "https://github.com/lab2023/heroicons-rails/blob/develop/lib/generators/heroicons/templates/initializer.rb"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_view toneBlue
class node_engine,node_helper,node_configuration,node_app_icons,node_bundled_icons,node_generator,node_initializer_template toneTeal
```

## Components

### Other components

- **Rails view**
- [Rails engine](https://github.com/lab2023/heroicons-rails/blob/develop/lib/heroicons/engine.rb): `lib/heroicons/engine.rb`
- [Icon helper](https://github.com/lab2023/heroicons-rails/blob/develop/app/helpers/heroicons/application_helper.rb): `app/helpers/heroicons/application_helper.rb`
- [Configuration](https://github.com/lab2023/heroicons-rails/blob/develop/lib/heroicons/configuration.rb): `lib/heroicons/configuration.rb`
- [Application icons](https://github.com/lab2023/heroicons-rails/tree/develop/app/assets/images/icons): `app/assets/images/icons`
- [Bundled icons](https://github.com/lab2023/heroicons-rails/tree/develop/app/assets/images/icons): `app/assets/images/icons`
- [Install generator](https://github.com/lab2023/heroicons-rails/blob/develop/lib/generators/heroicons/install_generator.rb): `lib/generators/heroicons/install_generator.rb`
- [Initializer template](https://github.com/lab2023/heroicons-rails/blob/develop/lib/generators/heroicons/templates/initializer.rb): `lib/generators/heroicons/templates/initializer.rb`

## Connections

- Rails engine → Icon helper: includes on load
- Rails view → Icon helper: calls icon_tag
- Icon helper → Configuration: reads defaults
- Icon helper → Application icons: searches first
- Icon helper → Bundled icons: searches fallback
- Icon helper → Rails view: returns SVG
- Install generator → Initializer template: copies template
