Loading tutorials
.module.css files (Vite, webpack, or Next.js all do this by default). It covers the import itself and the object it gives you. Later chapters cover combining classes, variants, and4 min read.module.css file and the browser. It assumes you can import a CSS Module and apply a class with styles.something. It also assumes you know CSS specificity and have used a bundler such as Vite, webpack, or Next.js.6 min read.module.css file become keys on the styles object. It also covers how to read those keys from JSX. It assumes you can already create and import a .module.css file and apply a class with styles.something. It also assumes you know the Java5 min read.module.css file and read from the styles object. Both were covered earlier in this tutorial. Here the question is what to do when one element needs more than one class.4 min readButton with a variant (primary or secondary) and a disabled state. It assumes you can already import a .module.css file and read styles.button. It also assumes you know basic React props and JSX, 5 min readcomposes declaration in CSS Modules. It lets one class build on another without copying declarations, and it keeps the component code simple. It assumes you can apply classes through the styles object, you know how generated class names keep CSS locally scoped, and you ha5 min read.module.css file, apply classes through the styles object, and read basic CSS selectors and specificity. It covers :global, the escape hatch from local scoping.6 min read.module.css file and apply styles.someClass, and understand the CSS cascade. Earlier chapters showed how to switch between a fixed set of classes. Here you will handle values that are not known until runtime, such6 min read.module.css file, rewrites the class names, and hands your JavaScript an object that maps the names you wrote to the names it generated. This chapter covers which tools do that work, what they need from you, and the errors you will see5 min read.module.css setup from the earlier chapters, and you know what tsconfig.json does. Runtime behavior of CSS Modules is not repeated here. The chapter covers only how the type checker sees a CSS Module import.6 min readstyles.button resolves from a .module.css import. It covers why tests fail when a component imports a CSS Module and how to configure Jest, Vitest and Next.js. It 5 min read.module.css file, import it as styles, combine classes with clsx, and use composes and :global. It collects the mistakes that show up most often in real projects and then describes a file layout that keeps them from recurring.6 min read