Skip to content

Commit 4ea5260

Browse files
committed
Update SKILL.md
1 parent f2be4b1 commit 4ea5260

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

SKILL.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ All `@devup-ui/react` components (`Box`, `Flex`, `Text`, etc.) throw `Error('Can
3636
|-------|------|-------|------|
3737
| `bg` | background | `m`, `mt`, `mr`, `mb`, `ml`, `mx`, `my` | margin-* |
3838
| `p`, `pt`, `pr`, `pb`, `pl`, `px`, `py` | padding-* | `w`, `h` | width, height |
39-
| `minW`, `maxW`, `minH`, `maxH` | min/max width/height | `gap` | gap |
39+
| `minW`, `maxW`, `minH`, `maxH` | min/max width/height | `boxSize` | width + height (same value) |
40+
| `gap` | gap | | |
4041

4142
### Spacing Scale (× 4 = px)
4243

@@ -84,6 +85,22 @@ All `@devup-ui/react` components (`Box`, `Flex`, `Text`, etc.) throw `Error('Can
8485
<Box bg={isActive ? "blue" : "gray"} /> // className={isActive ? "a" : "b"}
8586
```
8687

88+
### Dynamic Values with Custom Components
89+
90+
`css()` only accepts **static values** (extracted at build time). For dynamic values on custom components, use `<Box as={Component}>`:
91+
92+
```tsx
93+
// WRONG - css() cannot handle dynamic values
94+
const MyComponent = ({ width }) => (
95+
<CustomComponent className={css({ w: width })} /> // ERROR: width is dynamic!
96+
);
97+
98+
// CORRECT - use Box with `as` prop for dynamic values
99+
const MyComponent = ({ width }) => (
100+
<Box as={CustomComponent} w={width} /> // Works: generates CSS variable
101+
);
102+
```
103+
87104
## Styling APIs
88105

89106
### css() Returns className String (NOT object)
@@ -220,7 +237,7 @@ const sizeStyles = { lg: { h: '48px' }, md: { h: '40px' } }
220237
|-------|-------|-----|
221238
| `<Box style={{ color: "red" }}>` | `<Box color="red">` | style prop bypasses extraction |
222239
| `<Box {...css({...})} />` | `<Box className={css({...})} />` | css() returns string, not object |
223-
| `css({ bg: variable })` | `<Box bg={variable}>` | css()/globalCss() only accept static values |
240+
| `css({ bg: variable })` | `<Box bg={variable}>` or `<Box as={Comp} bg={variable}>` | css()/globalCss() only accept static values |
224241
| `$color` in external object | `var(--color)` in external object | $color only transformed in JSX props |
225242
| No build plugin configured | Configure plugin first | Components throw at runtime without transformation |
226243
| `as any` on style props | Fix types properly | Type errors indicate real issues |

0 commit comments

Comments
 (0)