You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If your selectors are dependent on each other you can use [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) to define them:
243
+
244
+
```ts compiled
245
+
// styles.css.ts
246
+
import { style } from'@vanilla-extract/css';
247
+
248
+
exportconst child =style({
249
+
background: 'blue',
250
+
get selectors() {
251
+
return {
252
+
[`${parent} &`]: {
253
+
color: 'red'
254
+
}
255
+
};
256
+
}
257
+
});
258
+
259
+
exportconst parent =style({
260
+
background: 'yellow',
261
+
selectors: {
262
+
[`&:has(${child})`]: {
263
+
padding: 10
264
+
}
265
+
}
266
+
});
267
+
```
268
+
240
269
## Container Queries
241
270
242
271
Container queries work the same as [media queries] and are nested inside the `@container` key.
0 commit comments