diff --git a/templates/docs/building-vanilla.md b/templates/docs/building-vanilla.md index 886372121..1b66661aa 100644 --- a/templates/docs/building-vanilla.md +++ b/templates/docs/building-vanilla.md @@ -498,3 +498,41 @@ Example HTML: ```html ``` + +## Component Class Mixing + +When using Vanilla, **component class names should not be mixed on the same element**. Each element should only have classes from one component, along with any applicable `is-` modifiers. + +### Recommended usage + +Wrap components in their own container elements: + +```html + +
+
+
+

Content here

+
+
+
+``` + +### Avoid + +Do not combine classes from different components on the same element: + +```html + +
+
+

Content here

+
+
+``` + +### Why this matters + +- **Predictable styling**: Each component's styles are designed to work independently. Mixing classes can lead to unexpected interactions. +- **Maintainability**: When components are properly separated, updating or debugging styles becomes easier. +- **Consistency**: Following this convention ensures your project looks and behaves consistently with other projects using Vanilla.