Anti-Patterns
When to Use
Consult this before finalizing a UI Styles implementation to avoid patterns that cause silent failures or maintenance debt.
Common Mistakes
- Wrong: declaring
extra: "<random>"everywhere → Right: extend the curated style options instead - Wrong: shipping a generic
borderplugin ID → Right: prefix with theme/module name (mytheme_border) - Wrong: defining one mega-style with 50 options → Right: split by axis (color, spacing, border) and category
- Wrong: using UI Styles to inject content/structure → Right: UI Styles is for classes only. Use SDC, Twig templates, or paragraphs for structure
- Wrong: hand-editing rendered HTML to add classes UI Styles already injects → Right: trust the form selections; if the class isn't appearing, debug the integration submodule
- Wrong: deleting a style definition without auditing references → Right: search config for
ui_stylesstorage keys before removing styles in production - Wrong: declaring options whose classes only render visibly with structural classes (e.g.
text-truncatewithoutd-block) withoutpreviewed_with→ Right: usepreviewed_withso the library page shows them honestly