[v4] How to support arbitrary CSS variables in custom utilties? #18792
Unanswered
kyletcooper
asked this question in
Help
Replies: 2 comments
-
Yep! Use the wildcard @utility my-utility-* {
property: --value([*]);
} Otherwise, if you only want to allow a specific type, you can do so, but your class names would need to have the hint too: @utility my-utility-* {
property: --value([length]);
} <div class="my-utility-(length:--css-variable)"> |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yes, Using the wildcard @utility my-utility-* {
property: --value([*]);
} Then in HTML:
Moreover, If you want stricter typing, you can replace * with a specific type, e.g., [length]:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to support the (--my-variable) arbitrary syntax when creating you're own custom utilities to allow CSS variables?
@utility my-utility-* { property: --value([variable]); }
.my-utility-\(--css-variable\){ property: var(--css-variable); }
Beta Was this translation helpful? Give feedback.
All reactions