Skip to content

Commit 396c218

Browse files
committed
docs: update
1 parent 2c42133 commit 396c218

File tree

3 files changed

+182
-0
lines changed

3 files changed

+182
-0
lines changed

website/content/docs/theming/animation-styles.mdx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,64 @@ export const popoverSlotRecipe = defineSlotRecipe({
9292
})
9393
```
9494

95+
## Nesting animation styles
96+
97+
Animation styles support nested structures with a special `DEFAULT` key. This allows you to create variants of an
98+
animation style while having a default fallback.
99+
100+
When you define a `DEFAULT` key within a nested animation style, you can reference the parent key directly to use the
101+
default value.
102+
103+
```js filename="panda.config.ts"
104+
export default defineConfig({
105+
theme: {
106+
extend: {
107+
animationStyles: {
108+
fade: {
109+
DEFAULT: {
110+
value: {
111+
animationName: 'fade-in',
112+
animationDuration: '300ms',
113+
animationTimingFunction: 'ease-in-out'
114+
}
115+
},
116+
slow: {
117+
value: {
118+
animationName: 'fade-in',
119+
animationDuration: '600ms',
120+
animationTimingFunction: 'ease-in-out'
121+
}
122+
},
123+
fast: {
124+
value: {
125+
animationName: 'fade-in',
126+
animationDuration: '150ms',
127+
animationTimingFunction: 'ease-in-out'
128+
}
129+
}
130+
}
131+
}
132+
}
133+
}
134+
})
135+
```
136+
137+
Now you can use the default fade animation or specific speed variants:
138+
139+
```jsx
140+
import { css } from '../styled-system/css'
141+
142+
function App() {
143+
return (
144+
<div>
145+
<div className={css({ animationStyle: 'fade' })}>Default fade speed</div>
146+
<div className={css({ animationStyle: 'fade.slow' })}>Slow fade</div>
147+
<div className={css({ animationStyle: 'fade.fast' })}>Fast fade</div>
148+
</div>
149+
)
150+
}
151+
```
152+
95153
## Best Practices
96154

97155
### Avoid Overuse

website/content/docs/theming/layer-styles.mdx

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,66 @@ function App() {
6565
return <div className={css({ layerStyle: 'container' })}>This is inside a container style</div>
6666
}
6767
```
68+
69+
## Nesting layer styles
70+
71+
Layer styles support nested structures with a special `DEFAULT` key. This allows you to create variants of a layer style
72+
while having a default fallback.
73+
74+
When you define a `DEFAULT` key within a nested layer style, you can reference the parent key directly to use the
75+
default value.
76+
77+
```js filename="panda.config.ts"
78+
export default defineConfig({
79+
theme: {
80+
extend: {
81+
layerStyles: {
82+
card: {
83+
DEFAULT: {
84+
value: {
85+
background: 'white',
86+
border: '1px solid',
87+
borderColor: 'gray.200',
88+
borderRadius: 'md',
89+
boxShadow: 'sm'
90+
}
91+
},
92+
elevated: {
93+
value: {
94+
background: 'white',
95+
border: 'none',
96+
borderRadius: 'lg',
97+
boxShadow: 'lg'
98+
}
99+
},
100+
outlined: {
101+
value: {
102+
background: 'transparent',
103+
border: '2px solid',
104+
borderColor: 'gray.300',
105+
borderRadius: 'md',
106+
boxShadow: 'none'
107+
}
108+
}
109+
}
110+
}
111+
}
112+
}
113+
})
114+
```
115+
116+
Now you can use the default card style or specific variants:
117+
118+
```jsx
119+
import { css } from '../styled-system/css'
120+
121+
function App() {
122+
return (
123+
<div>
124+
<div className={css({ layerStyle: 'card' })}>Default card style</div>
125+
<div className={css({ layerStyle: 'card.elevated' })}>Elevated card</div>
126+
<div className={css({ layerStyle: 'card.outlined' })}>Outlined card</div>
127+
</div>
128+
)
129+
}
130+
```

website/content/docs/theming/text-styles.mdx

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,67 @@ function App() {
7070
}
7171
```
7272

73+
## Nesting text styles
74+
75+
Text styles support nested structures with a special `DEFAULT` key. This allows you to create variants of a text style
76+
while having a default fallback.
77+
78+
When you define a `DEFAULT` key within a nested text style, you can reference the parent key directly to use the default
79+
value.
80+
81+
```js filename="panda.config.ts"
82+
export default defineConfig({
83+
theme: {
84+
extend: {
85+
textStyles: {
86+
heading: {
87+
DEFAULT: {
88+
value: {
89+
fontFamily: 'Inter',
90+
fontWeight: 'bold',
91+
fontSize: '1.5rem',
92+
lineHeight: '1.2'
93+
}
94+
},
95+
h1: {
96+
value: {
97+
fontFamily: 'Inter',
98+
fontWeight: 'bold',
99+
fontSize: '2.5rem',
100+
lineHeight: '1.1'
101+
}
102+
},
103+
h2: {
104+
value: {
105+
fontFamily: 'Inter',
106+
fontWeight: 'bold',
107+
fontSize: '2rem',
108+
lineHeight: '1.15'
109+
}
110+
}
111+
}
112+
}
113+
}
114+
}
115+
})
116+
```
117+
118+
Now you can use the default heading style or specific variants:
119+
120+
```jsx
121+
import { css } from '../styled-system/css'
122+
123+
function App() {
124+
return (
125+
<div>
126+
<h1 className={css({ textStyle: 'heading.h1' })}>Main Title</h1>
127+
<h2 className={css({ textStyle: 'heading.h2' })}>Subtitle</h2>
128+
<h3 className={css({ textStyle: 'heading' })}>Uses DEFAULT variant</h3>
129+
</div>
130+
)
131+
}
132+
```
133+
73134
## Best Practices
74135

75136
### Avoid layout properties

0 commit comments

Comments
 (0)