index.module.css.
File naming
Follow the component’s directory structure:Importing in TSX
.container in one component never collides with .container in another.
Writing styles
Use the@apply directive to compose Tailwind utilities inside CSS Modules:
Style guidelines
Use camelCase for class names
Use camelCase for class names
CSS Modules are accessed as JavaScript property lookups. Use camelCase so you can write
styles.myClassName without bracket notation.One Tailwind utility per line
One Tailwind utility per line
List each
@apply utility on its own line. This makes diffs easier to read and utilities easier to reorder.Prefer @apply over plain CSS
Prefer @apply over plain CSS
When a Tailwind utility covers what you need, use
@apply rather than writing plain CSS. This keeps the design system consistent.Keep styles scoped to the component
Keep styles scoped to the component
Never write styles that target elements outside the component’s root. Avoid global selectors inside module files.
Combining class names
When a component needs conditional or variant classes, combine them with template literals or theclassnames package (available as classnames in the monorepo):
Linting
CSS files are linted with Stylelint. Run the linter from the package root:stylelint-config-standard, stylelint-order, and stylelint-selector-bem-pattern.
Related
Tailwind CSS
How Tailwind v4 is configured and how @apply works.
Responsive design
Responsive breakpoints and mobile-first patterns.