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
`createCssContext` creates CSS helper functions (`css`, `cx`, `keyframes`, `viewTransition`, `Style`) with a custom context. You can use it to customize the style element ID and the generated class names.
If the `classNameSlug` function returns an invalid CSS class name, a warning is logged by default. You can customize this behavior with `onInvalidSlug`.
253
+
254
+
```ts
255
+
const { css, Style } =createCssContext({
256
+
id: 'my-styles',
257
+
classNameSlug: (hash, label) =>label||hash,
258
+
onInvalidSlug: (slug) => {
259
+
thrownewError(`Invalid CSS class name: ${slug}`)
260
+
},
261
+
})
262
+
```
263
+
215
264
## Tips
216
265
217
266
If you use VS Code, you can use [vscode-styled-components](https://marketplace.visualstudio.com/items?itemName=styled-components.vscode-styled-components) for Syntax highlighting and IntelliSense for CSS tagged literals.
0 commit comments