/emotion

⚡️ The Next Generation of CSS-in-JS

Primary LanguageJavaScriptMIT LicenseMIT

emotion

emotion

The Next Generation of CSS-in-JS

npm version Build Status codecov core gzip size core size react gzip size react size slack

emotion is a high performance, lightweight css-in-js library that supports both string and object based styles.


Sponsor


Quick Start

Get up and running with a single import.

npm install --save emotion
import { css } from 'emotion';

const app = document.getElementById('root');
const myStyle = css`
  color: rebeccapurple;
`
app.classList.add(myStyle);
npm install --save emotion react-emotion babel-plugin-emotion

Note: use preact-emotion in place of react-emotion if using Preact

import styled, { css } from 'react-emotion';

const Container = styled('div')`
  background: #333;
`
const myStyle = css`
  color: rebeccapurple;
`
const app = () => (
<Container>
  <p className={myStyle}>Hello World</p>
</Container>
);

Demo Code Sandbox

Examples

About

The core idea comes from Sunil Pai’s glam library and its philosophy is laid out here.

-- Introduction Article

API

Doc files

Ecosystem

In the Wild