Theming & 4-Tier Styling Contract
Methane styles never fight Shadow DOM. Every component exposes four explicit, SemVer-governed customization tiers:
| Tier | Mechanism | Contract |
|---|---|---|
| 1. Design Tokens | --mth-* custom properties | Compiled from W3C DTCG JSON using light-dark() and relative oklch(). Covered by SemVer. |
| 2. Parts & States | ::part(), exportparts, :state() | Stable semantic parts (base, control, label, popup) and CustomStateSet. Covered by SemVer. |
| 3. Sheet Escape Hatch | registerStyles(tagOrGlobal, css) | Appends Constructable CSSStyleSheet into @layer override via @methane-ui/runtime. Unparted internal selectors are SemVer-exempt. |
| 4. Unstyled / Primitives | Minimal structural sheet + @methane-ui/primitives | Swap the default theme or attach behavioral controllers to custom elements directly. |
Logical Properties & Density
100% of Methane stylesheets enforce CSS Logical Properties (padding-inline,inset-block-start, border-inline-start) via@methane-ui/lint-plugin and scale spacing automatically with[data-mth-density='compact' | 'default' | 'comfortable'].
Try customizing live OKLCH seeds and density in theInteractive OKLCH Theme Builder.