Emotion
ELI5 — The Vibe Check
Emotion is CSS-in-JS that gives you two flavors: the styled-components-like syntax AND a css prop for inline styles. It's like a Swiss Army knife for styling - pick whichever approach fits the moment. MUI uses it under the hood, so you might already be using it.
Real Talk
Emotion is a performant CSS-in-JS library offering both a styled API (similar to styled-components) and a css prop for inline style objects. It supports server-side rendering, automatic vendor prefixing, and source maps, and serves as the styling engine for Material UI.
Show Me The Code
const style = css`
color: hotpink;
font-size: 24px;
`;
<div css={style}>Styled with Emotion</div>
When You'll Hear This
"Emotion's css prop is great for one-off styles" / "MUI switched from JSS to Emotion and everything got faster"
Related Terms
CSS-in-JS
CSS-in-JS is the controversial philosophy of writing your styles in JavaScript instead of CSS files. Fans love the co-location and dynamic styling.
Material UI
Material UI (MUI) brings Google's Material Design to React.
Styled Components
Styled Components lets you write CSS right inside your JavaScript using tagged template literals.