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
Copy file name to clipboardExpand all lines: apps/docs/content/docs/02.api/10.recipes/00.index.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -476,4 +476,26 @@ recipe({
476
476
```
477
477
:::
478
478
479
+
:::accordion-item{label="Can I use auto-generated spacing values in recipes?"icon="i-lucide-circle-help"}
480
+
Yes! Spacing properties (`padding`, `margin`, `gap`) support auto-generated values using the `@` prefix with a number. These generate `calc()` expressions based on your `spacing` variable:
481
+
482
+
```ts [styleframe.config.ts]
483
+
recipe({
484
+
name: "card",
485
+
base: {
486
+
padding: "@1.5", // → calc(var(--spacing) * 1.5)
487
+
},
488
+
variants: {
489
+
spacing: {
490
+
compact: { padding: "@0.5" },
491
+
normal: { padding: "@1" },
492
+
relaxed: { padding: "@2" },
493
+
},
494
+
},
495
+
});
496
+
```
497
+
498
+
This allows flexible spacing without pre-defining every value, while keeping proportions consistent with your design system.
Copy file name to clipboardExpand all lines: apps/docs/content/docs/02.api/10.recipes/02.output-format.md
+53-2Lines changed: 53 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,7 +83,7 @@ Recipe field names (in camelCase) map directly to your defined utilities:
83
83
84
84
### Value Types and Class Suffixes
85
85
86
-
There are three ways to specify values in recipes, each producing different class suffixes:
86
+
There are four ways to specify values in recipes, each producing different class suffixes:
87
87
88
88
#### 1. Token References using `ref()`
89
89
@@ -122,7 +122,38 @@ recipe({
122
122
});
123
123
```
124
124
125
-
#### 3. Arbitrary Values
125
+
#### 3. Auto-generated Values
126
+
127
+
For spacing properties (padding, margin, gap), you can use numeric multiplier values with the `@` prefix. These generate `calc()` expressions based on your `spacing` variable.
-**Negative values**: `@-1`, `@-0.5` (useful for negative margins)
151
+
152
+
::tip
153
+
Auto-generated values provide flexibility without pre-defining every spacing value. They're especially useful for one-off adjustments while keeping your spacing proportional to the base `spacing` variable.
154
+
::
155
+
156
+
#### 4. Arbitrary Values
126
157
127
158
Any value that isn't a token reference is treated as an arbitrary value and wrapped in brackets.
128
159
@@ -303,4 +334,24 @@ Examples:
303
334
304
335
Class generation format can be customized via the instance's utilities selector option. See [Instance - Configuration Options](/docs/api/instance#utilitiesselector) for details.
305
336
:::
337
+
338
+
:::accordion-item{label="How do auto-generated values work in recipes?"icon="i-lucide-circle-help"}
339
+
Auto-generated values use the `@` prefix with a numeric value (e.g., `@1.5`, `@2`, `@-1`) for spacing properties like `padding`, `margin`, and `gap`. These generate utility classes that use `calc()` expressions:
0 commit comments