Learn how to use layer styles to define visual properties.
Layer styles allow you to define visual properties. The common properties are:
Layer styles are defined using the defineLayerStyles function.
import { defineLayerStyles } from '@chakra-ui/react'
const layerStyles = defineLayerStyles({
container: {
description: 'container styles',
value: {
background: 'gray.50',
border: '2px solid',
borderColor: 'gray.500',
},
},
})Chakra UI provides a set of built-in layer styles.
indicator.*
outline.*
states:
To use the layer styles, update the theme object with the layerStyles
property.
After updating the theme, run the typegen command to generate the typings. See
the CLI docs for how to run typegen in
postinstall, CI, and monorepos.
npm run preparepnpm run preparedeno run npm:preparebun run prepareNow you can use layerStyle property in your components.
<Box layerStyle="outline.subtle" />To utilize in the css function:
css({ layerStyle: 'outline.subtle' })On this page
Loading...
Loading...
Loading...
Loading...