Getting Started
Requirements
| Dependency | Version |
|---|---|
| Node.js | >= 18 |
| Sass | >= 1.97.1 |
Installation
bash
npm install @magnesium/themePlayground
Try it live on StackBlitz:
Usage
scss
@use "@magnesium/theme" with ($prefix: "ds");
$tokens: (
"text-color": darkcyan,
"font-size": 1rem
);
:root {
@include theme.emit($tokens, "button");
}css
:root {
--ds-button-text-color: darkcyan;
--ds-button-font-size: 1rem;
}pkg: importer
If your toolchain uses the Sass pkg: importer (Vite, modern bundlers), use the package name directly:
scss
@use "pkg:@magnesium/theme" with ($prefix: "ds");Both forms are equivalent — use whichever your setup requires.
Coming from v4?
See the migration guide for a complete mapping of the old API to v5.