Skip to content

Commit 5e7ec86

Browse files
authored
Add documentation about combining sprinkles and styles (#447)
1 parent de6ba53 commit 5e7ec86

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

site/docs/sprinkles-api.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,27 @@ export const sprinkles = createSprinkles(
342342
);
343343
```
344344

345+
As the sprinkles function returns a standard class list, you can combine it with a custom style using [style composition](/documentation/styling-api/#style).
346+
347+
```ts
348+
// button.css.ts
349+
import { style } from '@vanilla-extract/css';
350+
import { sprinkles } from './sprinkles.css';
351+
352+
export const button = style([
353+
sprinkles({
354+
paddingX: 'medium',
355+
paddingY: 'small'
356+
}),
357+
{
358+
transition: 'transform 0.2s ease-in-out',
359+
':hover': {
360+
transform: 'scale(1.1)'
361+
}
362+
}
363+
]);
364+
```
365+
345366
The sprinkles function also exposes a static `properties` key that lets you check whether a given property can be handled by the function.
346367

347368
```ts

0 commit comments

Comments
 (0)