React{ions}
React{ions} is a suite of React components that implement Ambassador's Design and UX patterns. They are designed to be re-usable and composable across large-scale web applications.
Installation
Ambassador's React{ions} is available as an npm package.
$ npm install react-ions
Prerequisites
React{ions} currently requires React 15.1+.
We use CSS Modules by default to import stylesheets written in SASS. In case you want to import the components already bundled with CSS, your module bundler should be able to require these SASS modules.
Example Webpack App
Here is an example React{ions} Webpack app to get you started.
Basic Usage
In this minimal example, we import a Button with styles already bundled:
import React from 'react'
import Button from 'react-ions/lib/Button'
<Button>I am a Button</Button>
Live examples and more info documentation site.
Icons
To limit the number of network requests, this library dynamically generates an .svg
sprite, to handle our user interfaces. The list of available icons is here: http://reactions.getambassador.com/foundations/iconography.
The list is primarily made up of Material Icons. However, there are a few social icons that we have added on our own.
If you've cloned the React:ions library, and wish to add/remove Material icons, or add custom (eg: non-Material) icons, to the sprite, follow the directions below.
To add a Material Icon to the svg sprite:
- Search for the icon on the Material Icon site.
- Open the master list
/react-ions/src/assets/icons/master-list.js
, and add the icon to thematerial
array.- The category of the icon is needed to construct the path.
- The hash after the path will be the
name
prop as passed into the React:ionsIcon
component. - All Material icon names should be prefixed with
md-
.
- Stop and then start the
React-ions
app - Go to: http://localhost:3000/foundations/iconography and your icon will be visible in the list.
To make a Custom Icon available in our apps:
- Follow the instructions for adding a
Material
app, however instead you will add to thembsy
array, and include a raw.svg
file here:/react-ions/src/assets/icons/svg
.