/** @jsxImportSource @emotion/react */
import { css } from '@emotion/react';
const buttonStyle = css`
background: hotpink;
border: none;
padding: 10px;
color: white;
`;
export const Button = () => <button css={buttonStyle}>Click</button>;
or styled 방식:
import styled from '@emotion/styled';
const Button = styled.button`
background: hotpink;
color: white;
`;
✅ 장점
❌ 단점
import styled from 'styled-components';
const Button = styled.button`
background: hotpink;
color: white;
`;
✅ 장점
❌ 단점
💡 요약: Emotion과 styled-components는 거의 같은 계열이에요.
요즘은 Emotion이 더 가볍고 빠르다고 해서 MUI 같은 라이브러리들도 Emotion으로 넘어옴.
<button className="bg-pink-500 text-white py-2 px-4 rounded">
Click
</button>
✅ 장점
❌ 단점
💡 요즘 React + Tailwind 조합 진짜 많아요.
Next.js, Remix, Vite 등 프론트엔드 세팅에서 기본 탑재되기도 해요.
| 항목 | Emotion | styled-components | Tailwind CSS |
|---|---|---|---|
| 스타일 방식 | CSS-in-JS | CSS-in-JS | Utility class |
| 작성 위치 | JS/TS 내부 | JS/TS 내부 | className 속성 |
| 런타임 성능 | 중간 | 다소 느림 | 빠름 (정적) |
| 코드 가독성 | 좋음 | 좋음 | 복잡해질 수 있음 |
| 커스터마이징 | 쉬움 | 쉬움 | 제한적 |
| 실무 사용량 | ✅ 많음 (특히 MUI 연동) | ⚪ 여전히 존재 | ✅ 폭발적 증가 (스타트업/Next.js) |
신규 프로젝트
→ Tailwind CSS + Next.js 조합이 압도적으로 많음
(빠르고 유지보수 편함)
디자인 시스템, 컴포넌트 단위 작업 필요
→ Emotion 사용 (특히 MUI 같은 기업용 UI 라이브러리)
기존 프로젝트 / 레거시
→ styled-components 여전히 많음
✅ 결론 요약
| 상황 | 추천 |
|---|---|
| 빠른 개발, 스타트업, 개인 프로젝트 | 🩵 Tailwind CSS |
| MUI 기반, 컴포넌트 설계 중심 | 💜 Emotion |
| 예전 코드 유지보수, 레거시 프로젝트 | 💛 styled-components |