Skip to content

Commit 0b2751d

Browse files
committed
forgot to move last bit of content
1 parent a414886 commit 0b2751d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

packages/dev/s2-docs/pages/s2/styling/Advanced.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@ export const description = 'Style macro advanced usage guide';
99

1010
A guide to advanced use cases with the `style` macro.
1111

12+
## Conditional styles
13+
14+
Define conditional values as objects to handle media queries, UI states (hover/press), and variants. This keeps all values for a property together.
15+
16+
```tsx
17+
<div
18+
className={style({
19+
padding: {
20+
default: 8,
21+
lg: 32
22+
}
23+
})}
24+
/>
25+
```
26+
27+
Conditions are mutually exclusive and ordered. The macro uses CSS cascade layers so the last matching condition wins without specificity issues.
28+
1229
## Runtime conditions
1330

1431
When runtime conditions are detected (e.g., variants, UI states), the macro returns a function to resolve styles at runtime.

0 commit comments

Comments
 (0)