Getting Started with Ruby on Rails

'material_design_icons' enables you to generate both HTML tags and inline SVG of Material Design Icons for your Ruby on Rails projects.


Add this line to your application's Gemfile:

gem 'material_design_icons'

And then execute:

$ bundle

Or install it yourself as:

$ gem install material_design_icons

Import the stylesheet by adding this line to your application's CSS manifest (application.css):

*= require materialdesignicons


Webfont Tags

mdi_tag(names, class: 'class-name')

You can specify a single or multiple Material Design Icons class names:

<%= mdi_tag('hexagon 48px') %>
<i class="mdi mdi-hexagon mdi-48px"></i>

You can optionally specify additional class names:

<%= mdi_tag('hexagon 48px', class: 'orange') %>
<i class="mdi mdi-hexagon mdi-48px orange"></i>

Inline SVG

mdi_svg(name, options={})

You can specify a single icon name with options:

<%= mdi_svg('hexagon') %>
<svg xmlns="" xmlns:xlink="" version="1.1" baseProfile="full" width="24" height="24" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve"> <path fill="#000000" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 16,3L 8,3L 3,8L 3,16L 8,21L 16,21L 21,16L 21,8"></path> </svg>

The inline SVG makes use of the inline_svg gem, so you can use any of the options it provides.