Advanced CSS Custom Properties for Components
summary
Demos show CSS custom properties used as a real component API: root tokens for design consistency, per-component overrides to avoid 50x variation bloat, and parent-level redefinitions for placement contexts like landing / text / sidebar. Examples use Twig single-directory components, the JavaScript style API to set variables at runtime, calc() for related spacing, and an actual AppState University implementation. The talk highlights @property type checking to reject wrong units and inline CSS variables via JS and notes media/container query support is still pending.
AI-written summary · about
chapters (10)
- 0:00Introduction to talk
- 3:30What is a component
- 8:44CSS custom properties overview
- 12:44Custom properties as variables
- 17:59Component variations and custom properties
- 21:36Component variations vs custom properties
- 27:44Solving complex padding scenarios
- 31:08Custom properties in calculations
- 34:00Type checking with custom properties
- 39:26Summary and Q&A
