Giter VIP home page Giter VIP logo

tabler_icons_ruby's Introduction

TablerIconsRuby

Gem Version Gem Total Downloads

  • Use any icon from over 4950+ tabler icons.
  • Works with/without Rails.
  • Easily customize things like size, colors, stroke width, classes & other HTML attributes.
  • Renders only icons you actually use as inline SVGs.
  • Unnecessary cruft removed - things like the xmlns attributes, width/height attributes (if not providing an explicit size) and the hidden bounding box that tabler icons adds are removed

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add tabler_icons_ruby

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install tabler_icons_ruby

If you're not using Rails, remember to require 'tabler_icons_ruby'

Usage

If you're using this with Rails, you can simply use this helper in your views:

<%= tabler_icon('player-play') %>

<%= tabler_icon('player-play', size: '18px', color: '#ff00ff') %>

<%= tabler_icon(:player_play, size: 20, color: :red, class: 'any-html-class other-class') %>

<%= tabler_icon('2fa', stroke_width: 2, 'data-controller' => 'something') %>

If you're not using Rails, or you'd like to use the tabler_icon helper from other places, you can simply include the helper in your class:

class SomeClass
  include TablerIconsRuby::Helper

  def call
    "icon: #{tabler_icon('player-play')}"
  end
end

If you don't like using the helper, you can render icons directly:

TablerIconsRuby.render(
  icon_name,
  size: size_of_icon,
  color: color_of_icon,
  class: html_class_to_add_to_icon,
  stroke_width: stroke_width_of_icon,
  **any_other_attributes_that_will_be_added_to_the_icon_svg_element
)

Interested in a powerful Rails UI library?

I am working on a super-powerful Rails UI library - components as well as templates & patterns.

Please check this out if you're interested.


Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/owaiswiz/tabler_icons_ruby.

License

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

Future

Might consider also incorporating icon fonts in this library. For that to be true though, I'd have to figure out a way to load things lazily as otherwise it'd load a lot of things. Similar to how modern font awesome kits work. They partition their huge icon set into multiple files. And load thigns on demand.

tabler_icons_ruby's People

Contributors

owaiswiz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tabler_icons_ruby's Issues

Icon search

Thank you for this gem! I have a question, what is the easiest way to do icon search? Maybe there is a built-in function?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.