styled components for react
npm install react-st-componentsjs
$ npm install react-st-components --save
`
$3
`js
import ReactDOM from 'react-dom';
import {
GlobalStyle, //for the global styles
STContainer
} from 'react-st-components';
const App = () => {
return (
<>
{/ Rest of your code /}
>
)
}
ReactDOM.render( , document.getElementById('index'))
`
$3
Wrap your application or selected parts with for it to pass down the themes.
`js
import ReactDOM from 'react-dom';
import { STThemeProvider } from 'react-st-components'; //for theme provider
import Header from './header-example';
import Contents from './contents-example';
const App = () => {
return (
<>
>
)
}
ReactDOM.render( , document.getElementById('index'))
`
The theme prop of the must be an object with this structure:
`js
const theme = {
tones: {
primary: '';
secondary: '';
success: '';
danger: '';
warning: ''
},
flat: true
}
`
- tones - [Object] containing the theme color palette(optional).
- tones. - [String] hex color code(optional).
- flat - [Boolean] if set to true, all border-radius of styled components is set to 0px`(optional, defaults to false).