Boostrap Icons Rails
bootstrap_icons_rails provides the Bootstrap Icons web fonts, stylesheets as a Rails engine for use with the asset pipeline.
Keep track of changes in Changelog.
Installation
Add this line to your application's Gemfile:
gem 'bootstrap_icons_rails'
Install as SVG with JS
In your application.css
, include the css file:
*= require bootstrap_icons
or if you prefer scss add this to your application.scss
file:
@import 'bootstrap_icons.css'; //application.scss
If you're using .sass
and having problem with loading, try to omit .css
extenstion and import font as follows:
@import 'bootstrap_icons';
Usage
Gem provides Bootstrap Icons through helper. In your views just call bi_icon
.
Basic usage
bi_icon('alarm')
# => <i class="bi bi-alarm"></i>
bi_icon('alarm', style: 'color: Tomato')
# => <i class="bi bi-alarm" style="color:Tomato"></i>
bi_icon('alarm', class: 'my-class', text: 'Alarm')
# => <i class="bi bi-alarm my-class"></i>
# => <span class="bi-text">Alarm</span>
bi_icon(:alarm, text: 'Alarm', right: true)
# => <span class="bi-text-r">Alarm</span>
# => <i class="bi bi-alarm"></i>
License
The gem is available as open source under the terms of the MIT License.