Go to file
Ian J. Miller 67bd60af76
Merge pull request #2 from ianmiller347/development
added new icons from feather 4.7
2018-04-10 23:03:23 -04:00
src added new icons from feather 4.7 2018-04-10 22:00:18 -05:00
.babelrc added new icons from feather 4.7 2018-04-10 22:00:18 -05:00
.eslintrc initial set of feather icons 2017-11-01 14:06:01 -05:00
.gitignore initial set of feather icons 2017-11-01 14:06:01 -05:00
.npmignore initial set of feather icons 2017-11-01 14:06:01 -05:00
package-lock.json 0.1.4 2017-11-16 14:37:27 -06:00
package.json added new icons from feather 4.7 2018-04-10 22:00:18 -05:00
README.md add search bar example to readme 2018-03-06 18:49:25 -06:00
yarn.lock added new icons from feather 4.7 2018-04-10 22:00:18 -05:00

Feather Icons React

npm

npm install --save feather-icons-react

This package lets you use Feather Icons as a React Component. Feather Icons is an svg font library by Cole Bemis.

Example usage:

import FeatherIcon from 'feather-icons-react';
<FeatherIcon icon="close" />

Setting a size:

Size can be passed as either string or number.

e.g.: <FeatherIcon icon="copy" size="24" /> or <... size={24} />

Sizes can always be easily overridden by CSS.

Dynamically change icons

Search Bar Container example:

export default const SearchBar = ({ currentIcon, onChange, onClick }) => {
  return (
    <div className='search-bar-container'>
      <input type='text' onChange={onChange} />
      <button className='search-bar__button' onClick={onClick}>
        <FontIcon icon={currentIcon} className='button--icon' />
      </button>
    </div>
  );
};

class SearchBarContainer extends Component {
  constructor(props) {
    super(props);

    this.state = {
      showingSuggestions: false
    };
  }

  toggleSuggestions = () => {
    this.setState({
      showingSuggestions: !this.state.showingSuggestions
    });
  }

  performSearch = (e) => {
    this.props.dispatch(searchFromInput(e.target.value));
  }

  render() {
    const { showingSuggestions } = this.state;
    const { suggestionsList } = this.props;
    const currentClass = (showingSuggestions) ? 'search' : 'x ';

    return (
      <SearchBar
        onChange={this.toggleSuggestions}
        currentIcon={currentClass}
        onClick={this.performSearch} />
    );
  }
}

The icons are all square, based on a 24x24 grid.

The full list of icon names can be referenced at: feathericons.com