CSS-normalize library for styled-components.
The original normalize.css
is pulled from necolas/normalize.css, and parsed into styled ready format.
npm install --save styled-normalize
styled-components createGlobalStyle documentation
This is just usage example
// ----- index.js
import React from 'react'
import { Normalize } from 'styled-normalize'
import { App } from './app'
const Root = () => (
<React.Fragment>
<Normalize />
<App />
</React.Fragment>
)
Also you can use createGlobalStyle
API:
// ----- styles/index.js
import { normalize } from 'styled-normalize'
import { createGlobalStyle } from 'styled-components'
const GlobalStyle = createGlobalStyle`
${normalize}
// You can continue writing global styles
body {
padding: 0;
background-color: black;
}
`
<GlobalStyle />
You can also use named imports:
// ES Modules
import { normalize, Normalize } from 'styled-normalize'
// CommonJS
const { normalize, Normalize } = require('styled-normalize')
createGlobalStyle` ${normalize} `
<Normalize />
If you want to use styled-normalize
with styled-components@v3
you should use prev
npm tag.
npm install styled-normalize@prev
v3 don't supports
createGlobalStyle
API.
NO SEMVER!
Why? Because X.Y numbers in vX.Y.Z
version matches X.Y in normalize.css
The MIT License