Forked react-toolbox with some fixes
 
 
 
 
Go to file
Mohan Kethees a26a1cdadf add .npmgnore 2015-11-25 09:38:00 -05:00
components changing months in datepicker (Firefox) is failing as event object is undefined 2015-11-24 23:46:31 +01:00
docs Add floating label for pickers. Fixes #137 2015-11-21 14:46:24 +01:00
spec Add floating label for pickers. Fixes #137 2015-11-21 14:46:24 +01:00
.babelrc use react-transform 2015-10-29 13:33:21 +08:00
.bumpedrc 💩 2015-11-11 21:58:28 +01:00
.csscomb.json Fix scss linter errors and bugfix in snackbar 2015-11-18 01:15:07 +01:00
.editorconfig Migrate button, ripple and font icon styles to sass and add sass tooling 2015-10-02 17:39:26 +02:00
.eslintignore use react-transform 2015-10-29 13:33:21 +08:00
.eslintrc Update eslint and plugins and add some rules to make it pass 2015-11-21 12:56:57 +01:00
.gitignore Set font URLs as variables 2015-11-09 03:46:52 +01:00
.npmignore add .npmgnore 2015-11-25 09:38:00 -05:00
.nvmrc Fix some errors and change opinionated eslint 2015-10-23 18:30:37 +02:00
.scss-lint.yml Fix scss linter errors and bugfix in snackbar 2015-11-18 01:15:07 +01:00
.travis.yml Update travis node to 4.2.1 2015-10-26 09:37:55 +01:00
LICENSE README initial version 2015-11-01 17:52:07 +01:00
README.md Update README.md 2015-11-21 21:50:28 +01:00
karma.conf.js Fix some errors and change opinionated eslint 2015-10-23 18:30:37 +02:00
package.json Merge pull request #125 from jonathanp/refactor-classname-generation 2015-11-21 19:59:50 +01:00
server.js removing UV_THREADPOOL_SIZE set, now executed from npm start script. 2015-11-16 19:04:43 -06:00
tests.webpack.js Fix some errors and change opinionated eslint 2015-10-23 18:30:37 +02:00
webpack.config.development.js Add toolbox version to webpack configuration 2015-11-12 00:26:23 +01:00
webpack.config.test.js use react-transform 2015-10-29 13:33:21 +08:00

README.md

React Toolbox

npm version Build Status NPM Status react-toolbox channel on discord Donate

React Toolbox is a set of React components that implement Google's Material Design specification. It's powered by CSS Modules and harmoniously integrates with your Webpack workflow. You can take a tour through our documentation website and try the components live!

Installation

React Toolbox can be installed as an npm package;

npm install --save react-toolbox

Usage

Although there are other ways to use React Toolbox, the recommended way is to create a Webpack workflow with Babel Loader, CSS Loader and SASS Loader. A good starting point is React Hot Webpack Boilerplate.

Once you have the workflow ready, you can just require and use the components:

import React from 'react';
import Button from 'react-toolbox/lib/button';

const CustomButton = () => (
  <Button label="Hello world" raised accent />
);

export default CustomButton;

The previous code creates a React button component based on React toolbox button. It's important to notice that requiring a module from the exposed root of the package will import the SASS of the component.

We encourage you to work with webpack but if you want to use React Toolbox in an old fashioned way you must generate a build with all the css and javascript and include it in your index.html. Then you can use the components exposed in the window object.

App component

There are some components in React Toolbox that requires special positioning. For example, Dialog and Drawer components block the scroll showing a fixed positioned overlay. To handle these cases, React Toolbox needs some styling in your root node. This can be achieved wrapping your app with a non intrusive App wrapper component:

import React from 'react';
import ReactDOM from 'react-dom';
import ToolboxApp from 'react-toolbox/lib/app';
import App from './my-app';

ReactDOM.render(
  <ToolboxApp>
    <App />
  </ToolboxApp>
, document.getElementById('app'));

Customization

Since React Toolbox styles are written in CSS it's pretty easy to customize your components. We have several ways:

Via React Toolbox Loader

Thanks to the power of SASS, all components in React Toolbox are configured from a variables file. The best way to customize your build is to create a custom configuration SASS file overriding configuration variables like colors or sizes.

With toolbox-loader you can tell webpack where your configuration file is and it will prepend your config to each SASS build. This will result in your customized CSS for React Toolbox Components. For now you can browse the configuration files and override what you want.

Via className property

Generally each component will have a className prop so you can tell the class name you want to keep in the root node of the resulting markup. All markup is style with the lowest specificity level so you can just nest one level in your CSS and the result will be applied. Consider this example:

const CustomButton = () => (
  <Button className='customized' label='Custom button' />
);

If you browse the resulting markup you will see data attributes like data-role="label" so you can avoid styling directly tag names. You can now write your CSS:

.customized > [data-role="label"] {
  color: green;
  font-weight: bold;
}

Authors and Contributors

The project is being initially developed and maintained by Javier Velasco and Javier Jiménez and the contribution scene is just getting warm. We want to create reference components so any contribution is very welcome.

To work in the project you'd need a node version with ES6 syntax. Although the project is built using Babel we use some ES6 features in the development server. Also, the packages has been tested with node 4.2.1. Consider using nvm or n to handle different node versions!

To start documentation site locally you'd need to install dependencies from the main package and also dependencies from the docs subproject:

git clone https://github.com/react-toolbox/react-toolbox.git
npm install
cd docs/
npm install 
npm start

Local documentation will be available at http://localhost:8081/

License

This project is licensed under the terms of the MIT license.