# [![npm version](https://img.shields.io/npm/v/react-toolbox.svg?style=flat-square)](https://www.npmjs.com/package/react-toolbox) [![Build Status](http://img.shields.io/travis/react-toolbox/react-toolbox/master.svg?style=flat-square)](https://travis-ci.org/react-toolbox/react-toolbox) [![NPM Status](http://img.shields.io/npm/dm/react-toolbox.svg?style=flat-square)](https://www.npmjs.org/package/react-toolbox) [![Donate](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square)](https://paypal.me/javivelasco) [![OpenCollective](https://opencollective.com/react-toolbox/backers/badge.svg)](#backers) [![OpenCollective](https://opencollective.com/react-toolbox/sponsors/badge.svg)](#sponsors) React Toolbox is a set of [React](http://facebook.github.io/react/) components that implement [Google's Material Design specification](https://material.google.com/). It's powered by [CSS Modules](https://github.com/css-modules/css-modules) and harmoniously integrates with your [webpack](http://webpack.github.io/) workflow, although you can use any other module bundler. You can take a tour through our documentation website and try the components live! **Note:** ⚠️ This source code refers to the [future version](https://github.com/react-toolbox/react-toolbox/blob/dev/ROADMAP.md). To check the source for `1.x` go to `master` branch. There is a [migration guide](https://github.com/react-toolbox/react-toolbox/wiki/Migrating-from-version-1.3-to-2.0) so you can start working with 2.0-beta.x now! ## Installation React Toolbox can be installed as an [npm package](https://www.npmjs.org/package/react-toolbox): ```bash $ npm install --save react-toolbox ``` ## Prerequisites React Toolbox uses [CSS Modules](https://github.com/css-modules/css-modules) by default to import stylesheets written using PostCSS/[cssnext](http://cssnext.io/) features. In case you want to import the components already bundled with CSS, your module bundler should be able to require these PostCSS modules. Although we recommend [webpack](https://webpack.github.io/), you are free to use whatever module bundler you want as long as it can compile and require PostCSS files located in your `node_modules`. If you are experiencing require errors, make sure your configuration satisfies this requirement. Of course this is a set of React components so you should be familiar with [React](https://facebook.github.io/react/). If want to customize your components via themes, you may want to take a look to [react-css-themr](https://github.com/javivelasco/react-css-themr) which is used by React Toolbox to make components easily themeable. ### Usage in Create React App Projects [Create React App](https://github.com/facebookincubator/create-react-app) does not allow to change the default configuration, so you need an additional build step to configure `react-toolbox` in its project. Follow [these instructions](https://github.com/react-toolbox/react-toolbox-themr) to add `react-toolbox` to a project created with Create React App. ### Usage in Webpack Projects (*Not* Create React App) ```bash npm install postcss-loader --save-dev npm install postcss --save npm install postcss-cssnext --save ``` Configure webpack 1.x loader for .css files to use postcss: ```js { test: /\.css$/, loaders: [ 'style-loader', 'css-loader?sourceMap&modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss?sourceMap&sourceComments', ], }, ``` Declare plugins to be used by postcss (as part of webpack's config object): ```js postcss: () => { return [ /* eslint-disable global-require */ require('postcss-cssnext'), /* eslint-enable global-require */ ]; }, ``` Configure webpack 2.x or 3.x loader for .css files to use postcss: ```js { test: /\.css$/, use: [ "style-loader", { loader: "css-loader", options: { modules: true, // default is false sourceMap: true, importLoaders: 1, localIdentName: "[name]--[local]--[hash:base64:8]" } }, "postcss-loader" ] } ``` ## Basic usage In this minimal example, we import a `Button` with styles already bundled: ```js import React from 'react'; import ReactDOM from 'react-dom'; import { Button } from 'react-toolbox/lib/button'; ReactDOM.render(