All Projects → abeidahmed → rails-heroicon

abeidahmed / rails-heroicon

Licence: MIT license
Ruby on Rails views helpers for the awesome heroicons by Steve Schoger.

Programming Languages

ruby
36898 projects - #4 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to rails-heroicon

icons
a collection of custom icons for use with the notion-enhancer's "icon sets" integration
Stars: ✭ 29 (+26.09%)
Mutual labels:  svg-icons
elm-feather
Feather icons for elm
Stars: ✭ 73 (+217.39%)
Mutual labels:  svg-icons
my api client
A framework of Web API Client. Provides features error handling, retrying, pagination and so on.
Stars: ✭ 19 (-17.39%)
Mutual labels:  gem
reproducible-continual-learning
Continual learning baselines and strategies from popular papers, using Avalanche. We include EWC, SI, GEM, AGEM, LwF, iCarl, GDumb, and other strategies.
Stars: ✭ 118 (+413.04%)
Mutual labels:  gem
acf-icon-picker
Creates an icon picker ACF field
Stars: ✭ 79 (+243.48%)
Mutual labels:  svg-icons
southwest-checkin
Easy-to-use gem to check in to Southwest flights automatically. Also supports sending email notifications.
Stars: ✭ 67 (+191.3%)
Mutual labels:  gem
click house
Modern Ruby database driver for ClickHouse
Stars: ✭ 133 (+478.26%)
Mutual labels:  gem
syobocal
Simle gem for Syboi Calendar
Stars: ✭ 13 (-43.48%)
Mutual labels:  gem
font-gis
Icon font and SVG for use with GIS and spatial analysis tools
Stars: ✭ 121 (+426.09%)
Mutual labels:  svg-icons
i18n lazy scope
Use lazy lookup with custom i18n scopes.
Stars: ✭ 11 (-52.17%)
Mutual labels:  gem
ssrf filter
A ruby gem for defending against Server Side Request Forgery (SSRF) attacks
Stars: ✭ 68 (+195.65%)
Mutual labels:  gem
hijri
Hijri date library for Ruby
Stars: ✭ 56 (+143.48%)
Mutual labels:  gem
active record-updated at
Touch `updated_at` by default with calls to `update_all` and `update_column(s)`
Stars: ✭ 27 (+17.39%)
Mutual labels:  gem
flagpack
A lightweight flag icon toolkit for the web.
Stars: ✭ 51 (+121.74%)
Mutual labels:  svg-icons
churnalizer
Analyze your Ruby app for Churn vs Complexity
Stars: ✭ 17 (-26.09%)
Mutual labels:  gem
react-ratings-declarative
A customizable rating component for selecting x widgets or visualizing x widgets
Stars: ✭ 41 (+78.26%)
Mutual labels:  svg-icons
harvesting
Ruby wrapper for the Harvest API v2
Stars: ✭ 24 (+4.35%)
Mutual labels:  gem
mixin bot
A simple API wrapper for Mixin Network in Ruby
Stars: ✭ 12 (-47.83%)
Mutual labels:  gem
backlog kit
Client library for the Nulab's Backlog API version 2 written in Ruby.
Stars: ✭ 28 (+21.74%)
Mutual labels:  gem
exception hunter
Crash reporting engine to hunt down bugs 🐞
Stars: ✭ 78 (+239.13%)
Mutual labels:  gem

Rails Heroicon ci

Ruby on Rails views helper for the awesome heroicons by Steve Schoger. To see all the icons visit heroicons.

292 icons included as of today.

This gem has no official affiliation with Tailwind Labs, yet.

Installation

Add this line to your application's Gemfile:

gem "rails_heroicon"

And then execute:

bundle install

Or install it yourself as:

gem install rails_heroicon

Usage

After installing the gem, call <%= heroicon "user" %> on your erb template. The first argument is the icon name. All the icons are listed here.

This will generate the following html:

<svg
  aria-hidden="true"
  width="24"
  height="24"
  viewBox="0 0 24 24"
  fill="none"
  stroke="currentColor"
  stroke-width="1.5"
  version="1.1"
>
  <path
    d="M16 7C16 9.20914 14.2091 11 12 11C9.79086 11 8 9.20914 8 7C8 4.79086 9.79086 3 12 3C14.2091 3 16 4.79086 16 7Z"
    stroke-width="2"
    stroke-linecap="round"
    stroke-linejoin="round"
  />
  <path
    d="M12 14C8.13401 14 5 17.134 5 21H19C19 17.134 15.866 14 12 14Z"
    stroke-width="2"
    stroke-linecap="round"
    stroke-linejoin="round"
  />
</svg>

Note: Indentation is for readibility purpose.

Variant

rails_heroicon provides 3 variants, outline, solid, and mini, outline being the default.

To change the variant <%= heroicon "user", variant: "solid" %>.

HTML attributes

Any html and eruby attribute is supported, for eg:

<%= heroicon "user", class: "text-gray-500", aria: { label: "user-icon" } %>

Handling the size of the icon

Normally, if you're just using vanilla heroicons with Tailwind CSS, you'd add w-5 h-5 as classes on the svg element. With rails_heroicon, you just need to set the size attribute on the helper method.

<%= heroicon "user", size: 20 %>

If the variant is set as outline or solid, size automatically defaults to 24, and if the variant is set as mini, size automatically defaults to 20. However, this can be over-written with the size attribute.

Accessibility

rails_heroicon automatically sets aria-hidden="true" if aria-label is not set, and if aria-label is set, then role="img" is set.

Tooltip

You can provide tooltips on hover if you pass in a title option. Anything passed into the title option will be rendered inside of a <title> tag within the rendered SVG, which modern browsers will lean on to display a tooltip on hover.

Development

  • Clone the repo
  • Run bundle install, or run ./bin/setup
  • Run bundle exec rake to run the tests to see if it passing

Contributing

Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

Please read the CONTRIBUTING.md on how to make pull requests.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Rails Heroicon project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Similar projects

  • rails_feather - Ruby on Rails views helper method for rendering beautiful feather icons.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].