is there a way to use anchorName/anchorPosition in stylex? #669
-
|
I tried using the defineVars for anchorPosition/anchorName but it returns https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_anchor_positioning/Using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Using variables is supported for anchor positioning, but the value of the variable must start with e.g. const anchors = stylex.defineVars({
myAnchor: '--my-anchor',
});The generated CSS will now be You can also do this without anchorName: '--my-anchor',This works and is explicitly supported. We do not currently have a special case for these properties to avoid wrapping them in |
Beta Was this translation helpful? Give feedback.
Using variables is supported for anchor positioning, but the value of the variable must start with
--e.g.
The generated CSS will now be
var(--somehash), but it will resolve to--my-anchorand will work as expected.You can also do this without
defineVarsat all and just use a string foranchorNamedirectly:This works and is explicitly supported.
We do not currently have a special case for these properties to avoid wrapping them in
var(). This is intentional because you can use variables for those properties.