{"id":14955267,"url":"https://github.com/getrailsui/railsui_icon","last_synced_at":"2025-08-25T00:32:37.052Z","repository":{"id":247144580,"uuid":"825091222","full_name":"getrailsui/railsui_icon","owner":"getrailsui","description":"A handy gem for rendering SVG icons","archived":false,"fork":false,"pushed_at":"2024-09-19T19:10:24.000Z","size":1041,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-17T11:03:01.910Z","etag":null,"topics":["gem","heroicons","heroicons-rails","inline-svg","rails","ruby","ruby-gem","ruby-on-rails","svg","svg-icons"],"latest_commit_sha":null,"homepage":"https://railsui.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getrailsui.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"justalever","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":"webcrunch","custom":null}},"created_at":"2024-07-06T18:39:46.000Z","updated_at":"2024-11-21T21:26:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"3500faa3-87ae-446a-8331-c879cab2113c","html_url":"https://github.com/getrailsui/railsui_icon","commit_stats":{"total_commits":22,"total_committers":1,"mean_commits":22.0,"dds":0.0,"last_synced_commit":"63ecb40e4f74d15c1ec72bc2b7985db4b5152452"},"previous_names":["getrailsui/railsui_icon"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getrailsui%2Frailsui_icon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getrailsui%2Frailsui_icon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getrailsui%2Frailsui_icon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getrailsui%2Frailsui_icon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getrailsui","download_url":"https://codeload.github.com/getrailsui/railsui_icon/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230856616,"owners_count":18290732,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gem","heroicons","heroicons-rails","inline-svg","rails","ruby","ruby-gem","ruby-on-rails","svg","svg-icons"],"created_at":"2024-09-24T13:10:47.382Z","updated_at":"2024-12-22T16:29:21.099Z","avatar_url":"https://github.com/getrailsui.png","language":"Ruby","funding_links":["https://github.com/sponsors/justalever","https://buymeacoffee.com/webcrunch"],"categories":[],"sub_categories":[],"readme":"# Rails UI - Icon\n\nThis is a standalone gem from the maker of [Rails UI](https://railsui.com) aimed at making rendering [heroicons](https://heroicons.com/) (_with more icons to come in the future_) in Rails applications easier.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"railsui_icon\"\n```\n\nAnd then execute:\n\n```bash\nbundle install\n```\n\nRun the installer\n\n```bash\nrails g railsui_icon:install\n```\n\nThe installer creates a new initializer where you can assign some defaults. A variant is required. Choose from `:solid`, `:outline`, `:mini`, and `:micro`.\n\n```ruby\n# config/initializers/railsui_icon.rb\n\nRailsuiIcon.configure do |config|\n  # Set the default icon variant (:solid, :outline, :mini, :micro)\n  config.default_variant = :outline\n\n  # Optionally set default classes that apply to every icon with the given variant.\n  # Make sure to update your Tailwind CSS config if you enable this setting.\n  # content: [\n  #  \"./config/initializers/railsui_icon.rb\",\n  # ],\n\n  config.default_class = {\n    solid: \"fill-current\",\n    outline: \"size-5\",\n    mini: \"size-3 fill-current\",\n    micro: \"size-3 fill-current\"\n  }\nend\n```\n\nOptionally set a `default_variant` and `default_class` which dictate how icons will render.\n\nThe gem will attempt to update a tailwind configuration automatically if you have one at the root of your project.\n\nIf you have a tailwind configuration elsewhere in your project be sure to update your content paths to include the new initializer.\n\n```javascript\n// tailwind.config.js\n\nmodule.exports = {\n  content: [\n    \"./config/initializers/railsui_icon.rb\",\n    // ...\n  ],\n}\n```\n\n## Usage\n\nRender icons with the `icon` helper method:\n\n```erb\n\u003c%= icon \"star\" %\u003e\n```\n\nBase rendering using the default variant of `:outline`.\n\n### Options\n\n**Variants**\n\nOptions: - `outline` - default, `solid`, `mini`, `micro`\n\nPass the `variant:` option to the icon helper with the appropriate variant in symbol form to modify with icon loads.\n\n```erb\n\u003c%= icon \"star\", variant: :micro %\u003e\n\u003c%= icon \"star\", variant: :mini %\u003e\n\u003c%= icon \"star\", variant: :outline %\u003e\n\u003c%= icon \"star\", variant: :solid %\u003e\n```\n\n**Add CSS classes**\n\n```erb\n\u003c%= icon \"star\", class: \"size-8 text-red-500 stroke-current\" %\u003e\n```\n\n**Disable default classes**\n\nIf you set default classes in your configuration you can disable those explicitly in one-off scenarios that might require it.\n\n```erb\n\u003c%= icon \"star\", disable_default_class: true %\u003e\n```\n\n**Pass a custom icon path**\n\nAdditional icons can be sourced from `app/assets/images`. Pass a custom path to render those. It's assumed the icon will be the `.svg` format. The path should be relative with a leading slash.\n\n- An icon name or nil value for the name is still required.\n- The file suffix is required in this scenario.\n\n```erb\n\u003c!-- Resolves from app/assets/images/logo.svg --\u003e\n\n\u003c%= icon \"logo\", custom_path: \"/logo.svg\" %\u003e\n\n```\n\n**The kitchen sink**\n\n```erb\n\u003c%= icon \"star\", variant: :micro, class: \"size-3 fill-current text-pink-500\", custom_path: \"/my_icons/star.svg\", disable_default_class: true %\u003e\n```\n\n## Bugs\n\nSpot something off? Open an issue on the [GitHub repo](https://github.com/getrailsui/railsui_icon). PRs welcomed!\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Rails UI\n\nBuild Ruby on Rails apps faster than ever with [Rails UI](https://railsui.com).\n\nRails UI features professionally designed components and templates for Ruby on Rails. Leverage breath-taking UI to fast-track your next idea.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetrailsui%2Frailsui_icon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetrailsui%2Frailsui_icon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetrailsui%2Frailsui_icon/lists"}