Method: Mtl::Rails::ViewHelpers#mtl_icon

Defined in:
lib/mtl/rails/view_helpers.rb

#mtl_icon(icon, options = {}) ⇒ String

Renders an ‘<i class=“material-icons”>icon</i>` tag to display an icon.

Parameters:

  • icon (Symbol)

    name of the icon to render, note that these are usually underscored, like e.g. ‘:aspect_ratio`

  • options (Hash) (defaults to: {})

    additional options passed to ‘content_tag`

Options Hash (options):

  • :size (:tiny, :small, :medium, :large)

Returns:

  • (String)

    HTML safe String



420
421
422
423
# File 'lib/mtl/rails/view_helpers.rb', line 420

def mtl_icon(icon, options = {})
  options[:class] = [Mtl.icon_class, options.delete(:size), options[:class]].compact
   :i, icon, options
end