{"name":"@fortawesome/react-fontawesome","description":"Official React component for Font Awesome 5","version":"0.1.0-5","main":"index.js","module":"index.es.js","jsnext:main":"index.es.js","types":"index.d.ts","homepage":"https://github.com/FortAwesome/react-fontawesome","repository":{"type":"git","url":"git+https://github.com/FortAwesome/react-fontawesome.git"},"contributors":[{"name":"Travis Chase","email":"travis@fontawesome.com"},{"name":"Rob Madole","email":"rob@fontawesome.com"},{"name":"Mike Wilkerson","email":"mwilkerson@gmail.com"}],"license":"MIT","scripts":{"build":"rollup -c rollup.config.js","dist":"cross-env NODE_ENV=production npm run build","lint":"eslint src","prettier":"pretty-quick src --staged","precommit":"npm run lint && npm run prettier","prepack":"npm run dist","test":"jest","clean":"rm -f index.js"},"peerDependencies":{"@fortawesome/fontawesome-svg-core":"^1.2.0-7","prop-types":"^15.5.10","react":"^16.0.0"},"devDependencies":{"@fortawesome/fontawesome-svg-core":"^1.2.0-7","@types/react":"^16.0.31","babel-eslint":"^8.2.1","babel-core":"^6.26.0","babel-jest":"^21.0.0","babel-plugin-external-helpers":"^6.22.0","babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","babel-preset-stage-3":"^6.24.1","cross-env":"^5.1.1","eslint":"^4.16.0","eslint-config-standard":"^11.0.0-beta.0","eslint-plugin-import":"^2.8.0","eslint-plugin-jest":"^21.7.0","eslint-plugin-node":"^5.2.1","eslint-plugin-promise":"^3.6.0","eslint-plugin-react":"^7.5.1","eslint-plugin-standard":"^3.0.1","husky":"^0.14.3","jest":"^21.0.1","prettier":"1.10.2","pretty-quick":"^1.2.2","prop-types":"^15.5.10","react":"16.0.0","react-test-renderer":"16.0.0","rollup":"0.50.0","rollup-plugin-babel":"^3.0.2","rollup-plugin-commonjs":"8.2.3","rollup-plugin-node-resolve":"^3.0.0"},"dependencies":{"humps":"^2.0.1"},"files":["index.js","index.es.js","index.d.ts"],"readme":"# react-fontawesome\n\n[![npm](https://img.shields.io/npm/v/@fortawesome/react-fontawesome.svg?style=flat-square)](https://www.npmjs.com/package/@fortawesome/react-fontawesome)\n\nFont Awesome 5 React component\n\n## Installation\n\n```\n$ npm i --save @fortawesome/fontawesome\n$ npm i --save @fortawesome/react-fontawesome\n```\n\nor\n\n```\n$ yarn add @fortawesome/fontawesome\n$ yarn add @fortawesome/react-fontawesome\n```\n\n## Usage\n\nYou can use Font Awesome icons in your React components as simply as this:\n```javascript\n<FontAwesomeIcon icon=\"coffee\"/>\n```\n\nThat simple usage is made possible when you add the `\"coffee\"` icon,\n to the _library_, or when _externally_ loading\nicon bundles that include the icon.\n\nThese are two of the three ways you can use\nFont Awesome 5 with React.\nWe'll summarize all three ways briefly and then get into the\ndetails of each below.\n\n1.  **Explicit Import**\n\n    Allows icons to be subsetted, optimizing your final bundle. Only the\n    icons you import are included in the bundle.\n    However, explicitly importing icons into each of many components\n    in your app might become tedious, so you may want to build a library.\n\n2. **Build a Library**\n\n    Explicitly import icons just once in some init module. Then add them\n    to the library. Then reference any of them by icon name as a string\n    from any component. No need to import the icons into each component\n    once they're in the library.\n\n3. **External Loading**\n\n    If you're in a situation where the icons have\n    been loaded externally, outside of your React component with a\n    `<script>` tag, then your React component can reference those icons\n    instead of doing its own import. You reference them from your React\n    component just as if you'd added them to the library: using the\n    icons names as strings.\n\n### Explicit Import\n\nFor this example, we'll also reference the <span style=\"white-space:nowrap;\">`@fortawesome/fontawesome-free-solid`</span>\nmodule, so make sure you've added it to the project as well:\n\n```\n$ npm i --save @fortawesome/fontawesome-free-solid\n```\n\nor\n\n```\n$ yarn add @fortawesome/fontawesome-free-solid\n```\n\nNow, a simple React component might look like this:\n\n```javascript\nimport ReactDOM from 'react-dom';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faCoffee } from '@fortawesome/fontawesome-free-solid/faCoffee'\n\nconst element = (\n  <FontAwesomeIcon icon={faCoffee} />\n)\n\nReactDOM.render(element, document.body)\n```\n\nNotice that the `faCoffee` icon is imported from\n<span style=\"white-space:nowrap;\">`@fortawesome/fontawesome-free-solid/faCoffee`</span> as an object and then\nprovided to the `icon` prop as an object.\n\nExplicitly importing icons like this allows us to subset Font Awesome's\nthousands of icons to include only those you use in your final bundled file.\n\n### Build a Library to Reference Icons Throughout Your App More Conveniently\n\nYou probably want to use our icons in more than one component in your app,\nright?\n\nBut with explicit importing, it could\nbecome tedious to import into each of your app's components every icon\nyou want to reference in that component.\n\nSo, add them to the _library_. Do this setup once in some initializing\nmodule of your app, adding all of the icons you'll use in your app's\nReact components.\n\nSuppose `App.js` initializes my app,\nincluding the library. For this example, we'll add two individual icons,\n`faCheckSquare` and `faCoffee`. We also add all of the brands in\n <span style=\"white-space:nowrap;\">`@fortawesome/fontawesome-free-brands`</span>.\n This example would illustrate the benefits of building a library\neven more clearly if it involved fifty or a hundred icons, but we'll\nkeep the example brief and leave it to your imagination as to how this\nmight scale up with lots of icons.\n\nDon't forget to add `@fortawesome/fontawesome-free-brands`:\n```\n$ npm i --save @fortawesome/fontawesome-free-brands\n```\n\nor\n\n```\n$ yarn add @fortawesome/fontawesome-free-brands\n```\n\nIn `App.js`, where our app is initialized:\n\n```javascript\nimport ReactDOM from 'react-dom';\nimport { library } from '@fortawesome/fontawesome'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { fab } from '@fortawesome/fontawesome-free-brands'\nimport { faCheckSquare } from '@fortawesome/fontawesome-free-solid/faCheckSquare'\nimport { faCoffee } from '@fortawesome/fontawesome-free-solid/faCoffee'\n\nlibrary.add(fab, faCheckSquare, faCoffee)\n```\n\nOK, so what's happening here?\n\nIn our call to <span style=\"white-space:nowrap;\">`library.add()`</span> we're passing\n* `fab`: which represents _all_ of the brand icons in\n<span style=\"white-space:nowrap;\">`@fortawesome/fontawesome-free-brands`</span>.\nSo any of the brand icons in that package may be referenced by icon name\nas a string anywhere else in our app.\nFor example: `\"apple\"`, `\"microsoft\"`, or `\"google\"`.\n* `faCheckSquare` and `faCoffee`: Adding each of these icons individually\nallows us to refer to them throughout our app by their icon string names,\n`\"check-square\"` and `\"coffee\"`, respectively.\n\nNow, suppose you also have React components `Beverage` and `Gadget` in your app.\nYou don't have to re-import your icons into them. Just import the `FontAwesomeIcon`\ncomponent, and when you use it, supply the icon prop an icon name as a string.\n\nWe'll make `Beverage.js` a functional component:\n```javascript\nimport React from 'react'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\n\nexport const Beverage = () => (\n    <div>\n        <FontAwesomeIcon icon=\"check-square\"/>\n        Favorite beverage: <FontAwesomeIcon icon=\"coffee\"/>\n    </div>\n)\n```\n\nThere's one another piece of magic that's happening in the\nbackground when providing icon names as strings like this: the `fas` prefix\n(for Font Awesome Solid) is being inferred as the default. Later, we'll look at what\nthat means and how we can do something different than the default.\n\nNow suppose `Gadget.js` looks like this:\n\n```javascript\nimport React from 'react'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\n\nexport const Gadget = () => (\n  <div>\n    <FontAwesomeIcon icon=\"check-square\"/>\n    Popular gadgets come from vendors like:\n      <FontAwesomeIcon icon={[\"fab\", \"apple\"]}/>\n      <FontAwesomeIcon icon={[\"fab\", \"microsoft\"]}/>\n      <FontAwesomeIcon icon={[\"fab\", \"google\"]}/>\n  </div>\n)\n```\n\nNotice:\n* We used the `\"check-square\"` icon name again in this component, though we\ndidn't have to explicitly import it into this component. With one explicit import of\nthat icon in `App.js`, and adding it to the library, we've managed to use\nit by name in multiple components.\n* We used the `\"apple\"`, `\"microsoft\"`, and `\"google\"` brand icons, which were\nnever explicitly _individually_ imported, but they're available to us by\nname as strings because `fab` was added to our library in `App.js`, and\n`fab` includes all of those icons.\n* We added the `fab` prefix to reference those brand icons.\n\nAdding a prefix—and the syntax we used to do it—are new. So what's\ngoing on here?\n\nFirst, recall when we introduced\n<span style=\"whitespace:nowrap;\">`<FontAwesomeIcon icon=\"coffee\"/>`</span>\nand learned that a prefix of `fas` was being added  to `\"coffee\"` by default.\n\nThe `\"check-square\"` icon is getting a default prefix of `fas` here too,\nwhich is what we want, because that icon also lives in the\n<span style=\"whitespace:nowrap;\">`@fortawesome/fontawesome-free-solid`</span>\npackage.\n\nHowever, the `\"apple\"`, `\"microsoft\"`, and `\"google\"` brand icons live in the\npackage <span style=\"whitespace:nowrap;\">`@fortawesome/fontawesome-free-brands`</span>.\nSo we need to specify a different prefix for them—not the default `fas`,\nbut `fab`, for Font Awesome _Brand_.\n\nWhen specifying a prefix with an icon name, both are given as strings.\n\nNow, what about that syntax?\n\nThe `icon` prop expects a single object:\n* It could be an icon object, like `{faCoffee}`.\n* It could a string object, like `\"coffee\"`.\n\n    (The curly braces around a string object supplied to a prop are\n    optional, so we've omitted them.)\n* Or it could be an `Array` of strings, where the first element is a\nprefix, and the second element is the icon name: `{[\"fab\", \"apple\"]}`\n\n### External Loading\n\nThere are some scenarios where you may want your React components to\nreference icons that have already been loaded globally with a `<script>`\ntag.\n\nFor example: a web site that is not a Single Page App. Maybe\n it involves a theme or template that makes use of Font Awesome icons by\n sourcing them in via `<script>` tag. Now you come along to add one or\n more React components to that web site. Instead of explicitly importing\n icons again into your components, you could reference the icons that\n have already been externally loaded.\n\nSuppose your React component is mounted in a DOM that has the following\nin its `<head>`:\n```\n <script src=\"https://example.com/fontawesome-free-solid.js\"></script>\n```\n\nNow you can reference any of the icons from within your React components\nas if you'd added them to the library:\n\n```javascript\n<FontAwesomeIcon icon=\"coffee\"/>\n```\n\n## Features\n\nIn the following code snippets, we'll use the shortcut notation for the\nicons—referencing the icons by their names as strings.\n\nBut remember, that option is only valid after you've either\nexplicitly imported and added those icons to the library, or externally\nloaded an icon bundle. See the sections above for the details.\n\n### Basic\n\nSpin and pulse animation:\n\n```javascript\n<FontAwesomeIcon icon=\"spinner\" spin />\n<FontAwesomeIcon icon=\"spinner\" pulse />\n```\n\nFixed width:\n\n```javascript\n<FontAwesomeIcon icon=\"spinner\" fixedWidth />\n```\n\nInverse:\n\n```javascript\n<FontAwesomeIcon icon=\"spinner\" inverse />\n```\n\nBorder:\n\n```javascript\n<FontAwesomeIcon icon=\"spinner\" border />\n```\n\nList items:\n\n```javascript\n<FontAwesomeIcon icon=\"spinner\" listItem />\n```\n\nFlip horizontally, vertically, or both:\n\n```javascript\n<FontAwesomeIcon icon=\"spinner\" flip=\"horizontal\" />\n<FontAwesomeIcon icon=\"spinner\" flip=\"vertical\" />\n<FontAwesomeIcon icon=\"spinner\" flip=\"both\" />\n```\n\nSize:\n\n```javascript\n<FontAwesomeIcon icon=\"spinner\" size=\"xs\" />\n<FontAwesomeIcon icon=\"spinner\" size=\"lg\" />\n<FontAwesomeIcon icon=\"spinner\" size=\"6x\" />\n```\n\nRotate:\n\n```javascript\n<FontAwesomeIcon icon=\"spinner\" rotate={90} />\n<FontAwesomeIcon icon=\"spinner\" rotate={180} />\n<FontAwesomeIcon icon=\"spinner\" rotate={270} />\n```\n\nPull left or right:\n\n```javascript\n<FontAwesomeIcon icon=\"spinner\" pull=\"left\" />\n<FontAwesomeIcon icon=\"spinner\" pull=\"right\" />\n```\n\nYour own class names:\n\n```javascript\n<FontAwesomeIcon icon=\"spinner\" className=\"highlight\" />\n```\n\n### Advanced\n\nPower Transforms:\n\n```javascript\n<FontAwesomeIcon icon=\"spinner\" transform=\"shrink-6 left-4\" />\n<FontAwesomeIcon icon=\"spinner\" transform={{ rotate: 42 }} />\n```\n\nComposition:\n\n```javascript\n<FontAwesomeIcon icon=\"coffee\" mask={['far', 'circle']} />\n```\n\nSymbols:\n\n```javascript\n<FontAwesomeIcon icon=\"edit\" symbol />\n<FontAwesomeIcon icon=\"edit\" symbol=\"edit-icon\" />\n```\n\n\nLayering:\n\n```javascript\n<span className=\"fa-layers fa-fw\">\n  <FontAwesomeIcon icon=\"square\" color=\"green\"/>\n  <FontAwesomeIcon icon=\"check\" inverse transform=\"shrink-6\"/>\n</span>\n```\n\n### TypeScript\n\nTypings are included in this package. However, most types are defined in the\nunderlying API library, <span style=\"whitespace:nowrap;\">`@fortawesome/fontawesome`</span>.\n\nSuppose that in one module, you add all `fas` icons to the library:\n```\nimport { library } from '@fortawesome/fontawesome'\nimport { fas } from '@fortawesome/fontawesome-free-solid'\n\nlibrary.add(fas)\n\n// ...\n```\n\nThen suppose that in another module, you have some code that looks up\none of the icons in the library. The `import` statement below imports two types\nand one function:\n\n```\nimport { IconLookup, IconDefinition, findIconDefinition } from '@fortawesome/fontawesome'\n\nconst coffeeLookup: IconLookup = { prefix: 'fas', iconName: 'coffee' }\nconst coffeeIconDefinition: IconDefinition = findIconDefinition(coffeeLookup)\n\n// ...\n\nexport class App extends React.Component {\n  render() {\n    return (\n      <div className=\"App\">\n          <h1>\n              <FontAwesomeIcon icon={coffeeIconDefinition} />\n          </h1>\n      </div>\n    );\n  }\n}\n```\nNOTE: You wouldn't normally declare intermediate objects like `coffeeLookup`\njust to look up an icon. So this is cumbersome and needlessly verbose for\nsuch a simple example. The purpose here is just to show how you might\nimport type definitions and use them in declarations when it _does_ make\nsense to do so.\n\nSeveral types, including `IconLookup` and `IconDefinition`, appearing above,\n actually originate from the\n<span style=\"whitespace:nowrap;\">`@fortawesome/fontawesome-common-types`</span>\npackage. They are re-exported from both <span style=\"whitespace:nowrap;\">`@fortawesome/fontawesome`</span>\nand <span style=\"whitespace:nowrap;\">`@fortawesome/fontawesome-free-solid`</span>\n(and other icon packs). This is just to make importing more convenient in\nsome cases.\nRefer to the `index.d.ts` in any module to see which types it exports.\n>>>>>>> add more documentation and more verbose example for TypeScript (#55)\n","readmeFilename":"README.md","gitHead":"423be574a14a00e763c0afd223031c5a16a0a526","bugs":{"url":"https://github.com/FortAwesome/react-fontawesome/issues"},"_id":"@fortawesome/react-fontawesome@0.1.0-5","_npmVersion":"5.7.1","_nodeVersion":"8.9.1","_npmUser":{"name":"robmadole","email":"robmadole@gmail.com"},"dist":{"integrity":"sha512-WdEZcJPC0MYcyRhVetxIe3aOr1AkQR8YoRsfMMIZoZ2FJQjUU5C5f8OcFOKbRMipVrfhl2dt0BlD6+VmP5VijQ==","shasum":"e96011db2d27ded97defa994165e7a463d87d2f1","tarball":"http://registry-npm.ywwl.com/@fortawesome/react-fontawesome/download/@fortawesome/react-fontawesome-0.1.0-5.tgz","fileCount":7,"unpackedSize":45552,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCuxNpSm8IAt/F+7D0SGgrcxPq0I33KDC3E0TFgZSYZkgIgDZFtFTp8nQbt9ldlFRAsAUb/bpSSMPhg3ti2HZtRhVY="}],"size":10791,"noattachment":false,"key":"/@fortawesome/react-fontawesome/-/@fortawesome/react-fontawesome-0.1.0-5.tgz"},"maintainers":[{"email":"admin@fortawesome.com","name":"fortawesome-admin"},{"email":"mwilkerson@gmail.com","name":"mwilkerson"},{"email":"robmadole@gmail.com","name":"robmadole"},{"email":"travis@travischase.me","name":"supercodepoet"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-fontawesome_0.1.0-5_1521476129492_0.82575854959276"},"_hasShrinkwrap":false,"publish_time":1521476129551,"deprecated":"v0.1x is no longer supported. Please update to v3.1.1 or greater.","_cnpm_publish_time":1521476129551,"dist-tags":{"latest":"3.5.0","latest-0.1":"0.1.19","latest-0.2":"0.2.6"}}