Module: Bootstrap::IconHelper

Defined in:
app/helpers/bootstrap/icon_helper.rb

Overview

Helper methods for Bootstrap icons.

See: twitter.github.io/bootstrap/base-css.html#icons

Examples:

Icons

icon(:search)
icon(:search, :white)
icon(:search, :white, id: 'my-id')

Icons with text

icon(:search, 'Search')
icon(:remove, :white, 'Delete')
icon(:ok, 'Save', id: 'my-id')

Text without icon

# so text lines up when you have text but no icon
icon(:blank, 'No icon')

Instance Method Summary collapse

Instance Method Details

#icon(*args) ⇒ String

Returns a Bootstrap icon glyph.

Optionally returns text with icon.

See class documentation (above) for examples.

Returns:

  • (String)


26
27
28
# File 'app/helpers/bootstrap/icon_helper.rb', line 26

def icon(*args)
  ::Bootstrap::IconRenderer.new(self, *args).html
end