Skip to the content.

Airbnb CSS-in-JavaScript Style Guide

A mostly reasonable approach to CSS-in-JavaScript

CSS-in-JavaScript に対する、程よく健全なアプローチ

Table of Contents

  1. Naming
  2. Ordering
  3. Nesting
  4. Inline
  5. Themes

Naming

Ordering

Nesting

Inline

Themes

Why? It is useful to have a set of shared variables for styling your components. Using an abstraction layer makes this more convenient. Additionally, this can help prevent your components from being tightly coupled to any particular underlying implementation, which gives you more freedom.

理由: コンポーネントのスタイリングに共有変数を利用できるのは便利です。抽象化レイヤーを使うことでこれがより簡単になります。さらに、特定の実装にコンポーネントが強く結びつくのを避けることができ、柔軟性が高まります。


CSS puns adapted from Saijo George.