Giter Club home page Giter Club logo

react-accessible-fa's Introduction

React Accessible Font Awesome Components

A small library which automatically adds a visually hidden text node, and an aria-hidden tag to Font Awesome icons. The markup aims to follow the pattern laid out in this blog post.

Installation

npm install react-accessible-fa

Usage

Usage is straightforward. First, make sure that your app includes the font-awesome CSS link somewhere.

import { AccessibleFAIcon as Icon } from './AccessibleFAIcon'

class Example extends React.Component {
  render() {
    return (
      <Icon animations={['spin']} icon="spinner" size="2x">
        Loading...
      </Icon>
    )
  }
}

ouputs to:

<div id="example">
  <span style="display:inline-block;" tabindex="0">
    <span style="clip:rect(1px, 1px, 1px, 1px);position:absolute !important;height:1px;width:1px;overflow:hidden;">
      Loading...
    </span>
    <i aria-hidden="true" class="fa fa-spinner fa-2x fa-spin"></i>
  </span>
</div>

Props

Note don't include the fa prefix in your props, the component adds that for you.

  • icon - required; the class of the icon to be displayed.
  • animations - an array of animation classes.
  • size - the size class you want to use.
  • tabIndex - sets the tabindex value. Default is 1.
  • text - passed in as children. If no text is supplied, the icon name will be used instead.

License

The MIT License (MIT) Copyright (c) 2015 Kevin Whitaker

react-accessible-fa's People

Stargazers

Gerald avatar Siddhartha Basu avatar Chris Witko avatar

Watchers

James Cloos 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.