theme-provider
React helpers for theming components. Works with inline styles or any css-in-js library.
Demos:
Installation
npm install --save react react-dom redux react-redux # peer dependencies npm install --save theme-provider
Usage
// MyApp.js { return <ThemeProvider theme=theme> <MyThemedComponent /> </ThemeProvider> } // theme variables primaryColor: 'blue'MyApp // or theme variables as a function of props primaryColor: propsprimaryColorMyApp
Check out the basic form example for the entire source.
// MyThemedComponent.js { return <div style=stylesbase /> } base: background: themeprimaryColor MyThemedComponent
Usage with Glamor
// MyThemedComponent.js { return <div ...stylesbase /> } base: MyThemedComponent
Usage with Aphrodite
// MyThemedComponent.js { return <div className= /> } StyleSheetMyThemedComponent