Skip to content

Instantly share code, notes, and snippets.

@Kcko
Last active October 12, 2025 17:34
Show Gist options
  • Save Kcko/e3b054f36e33de52e66e5dd5409c0a66 to your computer and use it in GitHub Desktop.
Save Kcko/e3b054f36e33de52e66e5dd5409c0a66 to your computer and use it in GitHub Desktop.
/* https://www.bitovi.com/blog/css-only-type-grinding-casting-tokens-into-useful-values */
@property --variant {
syntax: "primary|secondary|success|error";
initial-value: primary;
inherits: true;
}
@property --_v-primary-else-0 {
syntax: "primary|<integer>"; initial-value: 0; inherits: true;
}
@property --_v-primary-bit {
syntax: "<integer>"; initial-value: 1; inherits: true;
}
.element {
--variant: primary;
--_v-primary-else-0: var(--variant);
--_v-primary-bit: var(--_v-primary-else-0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment