Scoped Component Styles
Styling conflicts in complex applications are a quiet, persistent problem. A style intended for one component accidentally affects another. Adding a new component to a page changes the appearance of an existing one. A global style change has unexpected side effects in obscure corners of the application. The longer an application runs and the more it grows, the more these conflicts accumulate.
Scoped component styles prevent the problem at its root.
Each Component Is a Style Island
Every component in Swifty defines its styles in a scope local to the component. Styles defined for a table component apply only to elements within that table. A button component's hover style doesn't bleed into a button in a different component. A card component's spacing rules don't affect another card component on the same page.
The isolation is structural. Components don't share a style namespace. There's no way for one component's styles to affect another's, because they're evaluated in separate scopes.
What This Enables
Predictable composition: Place any component next to any other component and their styles don't interfere. The visual behavior of each is determined solely by its own styles, regardless of neighbors.
Safe updates: Updating the styles of one component can't accidentally break the appearance of any other component. Changes are contained.
Reuse without context anxiety: A well-styled component can be reused on any page without worry about the style environment it'll encounter. The component carries its styling with it.
Extension components: Third-party components added through extensions bring their own styles without risk of conflicting with platform component styles. The scoping mechanism applies to all components equally.
The Design System Layer
Scoped styles coexist with a shared design system layer. Colors, typography scales, spacing units, and interaction states are defined globally and are available to all component styles as design tokens. Components use the same vocabulary; they just apply it in isolation.
This means visual consistency across components — they all use the same blue for primary actions, the same font size for labels, the same border radius for cards — without the risk of styles leaking across component boundaries.
No Configuration Required
Scoped styles are automatic. Component authors write styles for their component; the scoping is handled by the platform. There are no class name conventions to follow, no naming discipline required to prevent conflicts. The architecture guarantees isolation.
For users building with the platform's components, this means the components simply work correctly together on any page — visual predictability is a property of the system, not something that needs to be carefully maintained.