Package Exports
- react-st-components
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-st-components) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-st-components
styled components for react
Install
NPM
$ npm install react-st-components --save
Usage
import ReactDOM from 'react-dom';
import { GlobalStyle, STContainer } from 'react-st-components'; //for the global style
const App = () => {
return (
<>
<GlobalStyle />
<STContainer>
{/* Rest of your code */}
</STContainer>
</>
)
}
ReactDOM.render(<App />, document.getElementById('index'))
Adding Theme
import ReactDOM from 'react-dom';
import { STThemeProvider } from 'react-st-components'; //for theme provider
const App = () => {
return (
<>
<STThemeProvider theme={theme}>
{/* Rest of your code */}
</STThemeProvider>
</>
)
}
ReactDOM.render(<App />, document.getElementById('index'))
The theme
prop of the <STThemeProvider />
must be an object with this structure:
const theme = {
tones: {
primary: '';
secondary: '';
success: '';
danger: '';
warning: ''
},
flat: true
}
- tones - [Object] containing the theme color palette(optional).
- tones.
- [String] hex
color code(optional).
- tones.
- flat - [Boolean] is set to
true
, allborder-radius
of styled components is set to0px
(optional, defaults to false).
See Docs for more styled components.