Current version: 0.11.2
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!
React Toolbox can be installed as an npm package;
npm install --save react-toolbox
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/button';
const CustomButton = () => (
<Button label="Hello world" kind="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.
Since React Toolbox styles are written in CSS it's pretty easy to customize your components. We have several ways:
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.
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;
}
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.
This project is licensed under the terms of the MIT license.