12.0.2 • Published 3 years ago

emotion-sanitize v12.0.2

Weekly downloads
2
License
MIT
Repository
gitlab
Last release
3 years ago

emotion-sanitize

npm version total downloads monthly downloads license

Sanitize.css ready to be used with Emotion CSS-in-JS API.

If you are wondering what the exact difference between Normalize.css and Sanitize.css is, you might find this comparison helpful.

For Normalize.css and Eric Meyer's Reset.css give these packages a try:

Installation

yarn add emotion-sanitize

or

npm install emotion-sanitize --save

Emotion

Since emotion-sanitize version 12.0.0, we have a peer dependency to @emotion/react version >= 11.x.

For earlier versions of emotion-sanitize, use @emotion/core version 10.x.

Usage

As component

import React from 'react';
import ReactDOM from 'react-dom';
import { SanitizeCSS } from 'emotion-sanitize';

const App = () => (
  <React.Fragment>
    <SanitizeCSS assets forms sanitize typography />
  </React.Fragment>
);

ReactDOM.render(<App />, document.querySelector('#app'));
Component propRequiredTypeDefault valueDescription
assetsnobooleanfalseInclude assets.css global styles
evergreennobooleanfalseInclude evergreen.css global styles
formsnobooleanfalseInclude forms.css global styles
formsEvergreennobooleanfalseInclude forms.evergreen.css global styles
pagenobooleanfalseInclude page.css global styles
reduceMotionnobooleanfalseInclude reduce-motion.css global styles
sanitizenobooleantrueInclude sanitize.css global styles
typographynobooleanfalseInclude typography.css global styles

Custom

import React from 'react';
import ReactDOM from 'react-dom';
import { Global, css } from '@emotion/core';
import { assets, forms, sanitize, typography } from 'emotion-sanitize';

const App = () => (
  <React.Fragment>
    <Global 
        styles={css`
            ${assets}
            ${forms}
            ${sanitize}
            ${typography}

            // your own global styles here
        `} 
    />
  </React.Fragment>
);

ReactDOM.render(<App />, document.querySelector('#app'));

Version

Major and minor versions of emotion-sanitize correspond to the major and minor versions of sanitize.css.

Patch level reflects updates to emotion-sanitize.

License

MIT License

12.0.2

3 years ago

12.0.1

3 years ago

12.0.0

3 years ago

11.0.3

4 years ago

11.0.2

4 years ago

11.0.1

4 years ago

11.0.0

4 years ago