Socket
Socket
Sign inDemoInstall

styled-normalize

Package Overview
Dependencies
22
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    styled-normalize

Normalize.css for styled-components CSS-in-JS library


Version published
Weekly downloads
130K
increased by8.8%
Maintainers
2
Install size
6.97 kB
Created
Weekly downloads
 

Readme

Source

styled-normalize

CSS-normalize library for styled-components.

The original normalize.css is pulled from necolas/normalize.css, and parsed into styled ready format.

Usage

npm install --save styled-normalize
yarn add styled-normalize

styled-components v4 / v5

Package exported normalize and Normalize. Normalize is a component with global styles. normalize is a css-normalize content to interpolate into styled component.

Use as component:

// index.js
import React from 'react'
import ReactDOM from 'react-dom'
import { Normalize } from 'styled-normalize'

import { App } from './app'

const Root = () => (
  <React.Fragment>
    <Normalize />
    <App />
  </React.Fragment>
)

ReactDOM.render(<Root />, document.querySelector('#root'))

Also you can use createGlobalStyle API:

// styles/index.js
import { createGlobalStyle } from 'styled-components'
import { normalize } from 'styled-normalize'

export const GlobalStyle = createGlobalStyle`
  ${normalize}

  // You can continue writing global styles here
  body {
    padding: 0;
    background-color: black;
  }
`

// index.js
import React from 'react'
import ReactDOM from 'react-dom'

import { GlobalStyle } from './styles'
import { App } from './app'

const Root = () => (
  <React.Fragment>
    <GlobalStyle />
    <App />
  </React.Fragment>
)

ReactDOM.render(<Root />, document.querySelector('#root'))

You can also use named imports:

// ES Modules
import { normalize, Normalize } from 'styled-normalize'

// CommonJS
const { normalize, Normalize } = require('styled-normalize')

styled-components v3

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.

Version

NO SEMVER!

Why? Because X.Y numbers in vX.Y.Z version matches X.Y in normalize.css

License

The MIT License

Keywords

FAQs

Last updated on 08 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc