+ return
+ Username
+
;
};
```
+:::note[Our personal go-to]
+In general, strict BEM can result in longer class names, which might affect code readability in your HTML. You can opt for a more relaxed version of BEM that allows for shorter class names and clean nesting.
+
+For example, instead of writing `.dropdown__option--active`, you could write `.dropdown-option--active` or even `.dropdown-option-active`.
+You can leverage scoped CSS Modules and SCSS's nesting capabilities to keep your styles scoped and organized while still compiling down to engine-friendly flat selectors.
+
+```scss
+.dropdown {
+ &-option {
+ /* Compiles to .dropdown-option */
+ &--active {
+ /* Compiles to .dropdown-option--active */
+ color: red;
+ }
+ }
+}
+```
+:::
+
### CSS-in-JS
-Libraries like Styled Components or Emotion allow you to write CSS directly inside your JavaScript files.
+CSS-in-JS is a pattern where you write your CSS directly inside your JavaScript or TypeScript files, usually using template literals or objects. Libraries like Styled Components, Emotion, or JSS are popular examples. They allow you to tightly couple your styles to your component logic and easily pass JavaScript variables (like props or state) directly into your CSS.
+
+```tsx title="CSS-in-JS Example (Not Recommended)"
+// Example of runtime CSS-in-JS (Styled Components)
+const StatusText = styled.span`
+ color: ${props => props.isOffline ? 'gray' : 'green'};
+ font-size: 1.2rem;
+`;
+```
-* **Pros:** Complete encapsulation and dynamic styling based on component state.
-* **Cons:** Standard CSS-in-JS libraries add significant runtime overhead because they parse and inject CSS via JavaScript on the fly. Since JavaScript execution shares resources heavily in Gameface, this can cause severe layout thrashing and frame drops during gameplay.
+* **Pros:** Complete encapsulation and highly dynamic styling based on component state.
+* **Cons:** Most standard CSS-in-JS libraries add significant **runtime overhead**. They work by parsing your JavaScript strings into CSS rules, generating classes, and injecting `