Packages
Rails
Solar Icons for Ruby on Rails views through the solar_icon helper.
# Gemfile
gem "solar_icons"Usage
The helper embeds the SVG with no network and no JavaScript:
<%= solar_icon("arrow-right") %>
<%= solar_icon("heart", weight: "bold-duotone", size: 32, class: "icon") %>Options:
weight:one oflinear(default),broken,line-duotone,outline,bold,bold-duotonesize:setswidthandheighttogetherstroke_width:overrides the stroke on Linear, Broken, and Line Duotone iconssecondary_color:andsecondary_opacity:(0 to 1) style the accent layer of the two duotone stylesalt:renders an accessible<title>and drops the defaultaria-hidden- any extra keyword becomes an SVG attribute (
style:,class:, ...);class:merges with configured defaults
Configuration
# config/initializers/solar_icons.rb
SolarIcons.configure do |config|
config.default_weight = "linear"
config.default_size = 24
config.default_attrs = { class: "icon" }
endSee solar_icons for the release history.
How is this guide?
Last updated on