Giter Site home page Giter Site logo

joedaniels29 / ember-cli-font-awesome Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mixonic/ember-cli-font-awesome

0.0 2.0 0.0 94 KB

ember-cli addon for using Font Awesome icons in Ember apps

License: The Unlicense

JavaScript 26.67% HTML 73.25% CSS 0.07%

ember-cli-font-awesome's Introduction

ember-cli-font-awesome

npm version Build Status Ember Observer Score

An ember-cli addon for using Font Awesome icons in Ember applications.

WARNING: Please verify that you are reading the README corresponding with the version of ember-cli-font-awesome you are using.

Install

In your application's directory:

$ ember install ember-cli-font-awesome

If you have manually installed or updated the addon via NPM then you should also run:

$ ember generate ember-cli-font-awesome

Ember Compatibility

Version >= 1.0.0 of this addon is compatible with Ember >= 1.11.X and requires Ember CLI >= 1.13.X. Version >= 0.1.0 < 1.0.0 of this addon is compatible with Ember >= 1.13.X and requires Ember CLI >= 1.13.X

If you need compatibility with Ember < 1.11.X then you should try version 0.0.9

Customize with sass/scss

You can opt-in to the scss version of font-awesome. You can do this by adding the following configuration in ember-cli-build.js:

var app = new EmberApp({
  emberCliFontAwesome: {
    useScss: true
  }
});

Then in your app.scss:

@import "bower_components/font-awesome/scss/font-awesome";

Basic usage

In your Handlebars templates:

{{fa-icon "camera"}}

NOTE: With Ember versions 1.11.X and 1.12.X you must specify the the icon as a hash param, as these versions do not support positionalParam.

{{fa-icon icon="camera"}}

This will render:

<i class="fa fa-camera"></i>

If you prefer, you can use the fa- prefix in the icon name.

{{fa-icon "fa-camera"}}
{{fa-icon "camera"}}

Complete list of Font Awesome icons

Options

The Font Awesome examples illustrate the various options and their effects. It should be obvious how these options map to their fa-icon counterparts.

Different icon sizes

{{fa-icon "star" size="lg"}}
{{fa-icon "star" size=2}}
{{fa-icon "star" size=3}}
{{fa-icon "star" size=4}}
{{fa-icon "star" size=5}}

Rotate

{{fa-icon "camera" rotate=90}}
{{fa-icon "camera" rotate=180}}
{{fa-icon "camera" rotate=270}}

Flip

{{fa-icon "bicycle" flip="horizontal"}}
{{fa-icon "car" flip="vertical"}}

Spin

{{fa-icon "refresh" spin=true}}

Pulse

{{fa-icon "spinner" pulse=true}}

Inverse

{{fa-icon "circle" inverse=true}}

List icons

{{fa-icon "star" listItem=true}}

In combination with the {{fa-list}} and {{fa-list-icon}} components:

{{#fa-list}}
  <li>{{fa-list-icon "star"}}Item 1</li>
  <li>{{fa-list-icon "star"}}Item 2</li>
{{/fa-list}}

Fixed width icons

<div class="list-group">
  <a class="list-group-item" href="#">
    {{fa-icon "home" fixedWidth=true}} Home
  </a>
  <a class="list-group-item" href="#">
    {{fa-icon "book" fixedWidth=true}} Library
  </a>
</div>

Bordered & pulled icons

<p>
{{fa-icon "quote-left" pull="left" border=true}}
...tomorrow we will run faster, stretch out our arms farther...
And then one fine morning— So we beat on, boats against the
current, borne back ceaselessly into the past.
</p>

Stacked icons

{{#fa-stack size="lg"}}
  {{fa-icon "fa-square-o" stack=2}}
  {{fa-icon "fa-twitter" stack=1}}
{{/fa-stack}}

aria-hidden attribute

To better support accessibility (i.e. screen readers), the helper now generates an aria-hidden attribute by default:

{{fa-icon "star"}}
{{!-- results in: --}}
<i class="fa fa-star" aria-hidden="true"></i>

To remove the aria-hidden attribute:

{{fa-icon "star" ariaHidden=false}}
{{!-- results in: --}}
<i class="fa fa-star"></i>

Actions

You can respond to actions on the icon by passing on action handlers:

{{fa-icon "star" click=(action "myClickHandler")}}

Tag name

Use tagName to control the generated markup:

{{fa-icon "star" tagName="span"}}
{{!-- results in: --}}
<span class="fa fa-star"></span>

Custom class names

{{fa-icon "bicycle" class="my-custom-class"}}
{{!-- results in: --}}
<i class="fa fa-bicycle my-custom-class"></i>

Title attribute

{{fa-icon "edit" title="Edit the item"}}
{{!-- results in: --}}
<i class="fa fa-edit" title="Edit the item"></i>

License

Public Domain

ember-cli-font-awesome's People

Contributors

ajcobo avatar joedaniels29 avatar laurens-runnable avatar quaertym avatar rwjblue avatar sebastianedwards avatar suluke avatar xiphiasuvella avatar

Watchers

 avatar  avatar

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.