Skip to content

Rails

Table of contents
Table of contents

Gem version

The Rails helper lets you include octicons in your Rails apps.

Install

  1. Add this to your Gemfile

    gem 'octicons_helper'
  2. Use this tag in your erbs

    <%= octicon "alert", :height => 32, :class => "right left", :"aria-label" => "hi" %>

We recommend including the CSS in the @primer/octicons npm module. You can also npm install that package and include build/build.css in your styles.

Caching

octicons_helper caches repeated calls to octicon based on the name of the icon and the provided options hash. Avoid arbitrary/high cardinality options (such as an id with a unique record identifier), as they can cause a memory leak.