본문으로 건너뛰기

스타일 프롭

스타일 프롭은 간단히 프롭을 전달하여 컴포넌트의 스타일을 변경하는 방법입니다. 컴포넌트의 스타일을 지정하는 유용한 약칭을 이용해 시간을 절약할 수 있습니다.

참고

다음 표는 모든 스타일 프롭의 목록과 해당하는 CSS 속성을 보여줍니다.

마진과 패딩

jsx
import { Box } from "@chakra-ui/react"
// m={2}는 theme.space[2]의 값을 나타냅니다.
<Box m={2}>Tomato</Box>
// 사용자 지정 값을 사용하는 것도 가능합니다.
<Box maxW="960px" mx="auto" />
// 모든 뷰포트에 마진 8px을 설정하고 첫 번째 중단점 이상에 12px을 설정합니다.
<Box m={[2, 3]} />
jsx
import { Box } from "@chakra-ui/react"
// m={2}는 theme.space[2]의 값을 나타냅니다.
<Box m={2}>Tomato</Box>
// 사용자 지정 값을 사용하는 것도 가능합니다.
<Box maxW="960px" mx="auto" />
// 모든 뷰포트에 마진 8px을 설정하고 첫 번째 중단점 이상에 12px을 설정합니다.
<Box m={[2, 3]} />
프롭CSS 프로퍼티테마 키
m, marginmarginspace
mt, marginTopmargin-topspace
mr, marginRightmargin-rightspace
me, marginEndmargin-inline-endspace
mb, marginBottommargin-bottomspace
ml, marginLeftmargin-leftspace
ms, marginStartmargin-inline-startspace
mx, marginXmargin-inline-start + margin-inline-endspace
my, marginYmargin-top + margin-bottomspace
p, paddingpaddingspace
pt, paddingToppadding-topspace
pr, paddingRightpadding-rightspace
pe, paddingEndpadding-inline-endspace
pb, paddingBottompadding-bottomspace
pl, paddingLeftpadding-leftspace
ps, paddingStartpadding-inline-startspace
px, paddingXpadding-inline-start + padding-inline-endspace
py, paddingYpadding-top + padding-bottomspace
참고

mxpx 프롭은 생성된 스타일이 RTL 친화적임을 보장하기 위해 margin-inline-startmargin-inline-end를 사용합니다.

색상과 배경색

jsx
import { Box } from "@chakra-ui/react"
// 점 표기법을 사용하여 중첩된 색상 값을 선택합니다.
// => `theme.colors.gray[50]`
<Box color='gray.50' />
// 원시 CSS 색상 값
<Box color='#f00' />
// 배경색
<Box bg='tomato' />
// 장황한 프롭
<Box backgroundColor='tomato' />
jsx
import { Box } from "@chakra-ui/react"
// 점 표기법을 사용하여 중첩된 색상 값을 선택합니다.
// => `theme.colors.gray[50]`
<Box color='gray.50' />
// 원시 CSS 색상 값
<Box color='#f00' />
// 배경색
<Box bg='tomato' />
// 장황한 프롭
<Box backgroundColor='tomato' />
프롭CSS 프로퍼티테마 키
colorcolorcolors
bg, backgroundbackgroundcolors
bgColorbackground-colorcolors
opacityopacity없음

그레이디언트

jsx
import { Box, Text } from "@chakra-ui/react"
// 선형 그레이디언트와 색상 트랜지션을 추가합니다.
<Box w="100%" h="200px" bgGradient="linear(to-t, green.200, pink.500)" />
// 방사형 그레이디언트와 색상 트랜지션을 추가합니다.
<Box w="100%" h="200px" bgGradient="radial(gray.300, yellow.400, pink.200)" />
// 텍스트 그레이디언트를 추가합니다.
<Text
bgGradient="linear(to-l, #7928CA, #FF0080)"
bgClip="text"
fontSize="6xl"
fontWeight="extrabold"
>
Welcome to Chakra UI
</Text>
jsx
import { Box, Text } from "@chakra-ui/react"
// 선형 그레이디언트와 색상 트랜지션을 추가합니다.
<Box w="100%" h="200px" bgGradient="linear(to-t, green.200, pink.500)" />
// 방사형 그레이디언트와 색상 트랜지션을 추가합니다.
<Box w="100%" h="200px" bgGradient="radial(gray.300, yellow.400, pink.200)" />
// 텍스트 그레이디언트를 추가합니다.
<Text
bgGradient="linear(to-l, #7928CA, #FF0080)"
bgClip="text"
fontSize="6xl"
fontWeight="extrabold"
>
Welcome to Chakra UI
</Text>
프롭CSS 프로퍼티테마 키
bgGradientbackground-image없음
bgClip, backgroundClipbackground-clip없음

타이포그래피

jsx
import { Text } from "@chakra-ui/react"
// theme.fontSizes.md의 font-size
<Text fontSize="md" />
// font-size 32px
<Text fontSize={32} />
// font-size 2em
<Text fontSize='2em' />
// 모든 뷰포트에 text-align left를 설정하고 첫 번째 중단점 이상에 center를 설정합니다.
<Text textAlign={[ 'left', 'center' ]} />
jsx
import { Text } from "@chakra-ui/react"
// theme.fontSizes.md의 font-size
<Text fontSize="md" />
// font-size 32px
<Text fontSize={32} />
// font-size 2em
<Text fontSize='2em' />
// 모든 뷰포트에 text-align left를 설정하고 첫 번째 중단점 이상에 center를 설정합니다.
<Text textAlign={[ 'left', 'center' ]} />
프롭CSS 프로퍼티테마 키
fontFamilyfont-familyfonts
fontSizefont-sizefontSizes
fontWeightfont-weightfontWeights
lineHeightline-heightlineHeights
letterSpacingletter-spacingletterSpacings
textAligntext-align없음
fontStylefont-style없음
textTransformtext-transform없음
textDecorationtext-decoration없음

레이아웃, 너비와 높이

jsx
import { Box } from "@chakra-ui/react"
// 장황함
<Box width="100%" height={32} />
// 약칭
<Box w="100%" h="32px" />
// 테마의 크기 사용
<Box boxSize="sm" />
// 너비 256px
<Box w={256} />
// 너비 40px
<Box w='40px' />
jsx
import { Box } from "@chakra-ui/react"
// 장황함
<Box width="100%" height={32} />
// 약칭
<Box w="100%" h="32px" />
// 테마의 크기 사용
<Box boxSize="sm" />
// 너비 256px
<Box w={256} />
// 너비 40px
<Box w='40px' />
프롭CSS 프로퍼티테마 키
w, widthwidthsizes
h, heightheightsizes
minW, minWidthmin-widthsizes
maxW, maxWidthmax-widthsizes
minH, minHeightmin-heightsizes
maxH, maxHeightmax-heightsizes
displaydisplay없음
boxSizewidth, heightsizes
verticalAlignvertical-align없음
overflowoverflow없음
overflowXoverflow-x없음
overflowYoverflow-y없음

플렉스박스

jsx
import { Box, Flex } from "@chakra-ui/react"
// 장황함
<Box display="flex" alignItems="center" justifyContent="space-between">
Box with Flex props
</Box>
// Flex 컴포넌트를 이용한 약칭
<Flex align="center" justify="center">
Flex Container
</Flex>
jsx
import { Box, Flex } from "@chakra-ui/react"
// 장황함
<Box display="flex" alignItems="center" justifyContent="space-between">
Box with Flex props
</Box>
// Flex 컴포넌트를 이용한 약칭
<Flex align="center" justify="center">
Flex Container
</Flex>
참고

* 프롭은 Flex 컴포넌트를 사용할 때만 작동합니다.

프롭CSS 프로퍼티테마 키
gapgapspace
rowGaprow-gapspace
columnGapcolumn-gapspace
alignItems, *alignalign-items없음
alignContentalign-content없음
justifyItemsjustify-items없음
justifyContent, *justifyjustify-content없음
flexWrap, *wrapflex-wrap없음
flexDirection, flexDir, *directionflex-direction없음
flexflex없음
flexGrowflex-grow없음
flexShrinkflex-shrink없음
flexBasisflex-basis없음
justifySelfjustify-self없음
alignSelfalign-self없음
orderorder없음

그리드 레이아웃

jsx
import { Box, Grid } from "@chakra-ui/react"
// 장황함
<Box display="grid" gridGap={2} gridAutoFlow="row dense">
Grid
</Box>
// Grid 컴포넌트를 이용한 약칭
<Grid gap={2} autoFlow="row dense">
Grid
</Grid>
jsx
import { Box, Grid } from "@chakra-ui/react"
// 장황함
<Box display="grid" gridGap={2} gridAutoFlow="row dense">
Grid
</Box>
// Grid 컴포넌트를 이용한 약칭
<Grid gap={2} autoFlow="row dense">
Grid
</Grid>
참고

* 프롭은 Grid 컴포넌트를 사용할 때만 작동합니다.

프롭CSS 프로퍼티테마 키
gridGap, *gapgrid-gapspace
gridRowGap, *rowGapgrid-row-gapspace
gridColumnGap, *columnGapgrid-column-gapspace
gridColumn, *columngrid-column없음
gridRow, *rowgrid-row없음
gridArea, *areagrid-area없음
gridAutoFlow, *autoFlowgrid-auto-flow없음
gridAutoRows, *autoRowsgrid-auto-rows없음
gridAutoColumns, *autoColumnsgrid-auto-columns없음
gridTemplateRows, *templateRowsgrid-template-rows없음
gridTemplateColumns, *templateColumnsgrid-template-columns없음
gridTemplateAreas, *templateAreasgrid-template-areas없음

배경

jsx
import { Box } from "@chakra-ui/react"
// 장황함
<Box
backgroundImage="url('/images/kyuubi.png')"
backgroundPosition="center"
backgroundRepeat="no-repeat"
/>
// 약칭
<Box
bgImage="url('/images/gaara.png')"
bgPosition="center"
bgRepeat="no-repeat"
/>
jsx
import { Box } from "@chakra-ui/react"
// 장황함
<Box
backgroundImage="url('/images/kyuubi.png')"
backgroundPosition="center"
backgroundRepeat="no-repeat"
/>
// 약칭
<Box
bgImage="url('/images/gaara.png')"
bgPosition="center"
bgRepeat="no-repeat"
/>
프롭CSS 프로퍼티테마 키
bg, backgroundbackground없음
bgImage, backgroundImagebackground-image없음
bgSize, backgroundSizebackground-size없음
bgPosition, backgroundPositionbackground-position없음
bgRepeat, backgroundRepeatbackground-repeat없음
bgAttachment, backgroundAttachmentbackground-attachment없음

테두리

jsx
<Box border='1px' borderColor='gray.200'>
Card
</Box>
jsx
<Box border='1px' borderColor='gray.200'>
Card
</Box>
프롭CSS 프로퍼티테마 필드
borderborderborders
borderWidthborder-widthborderWidths
borderStyleborder-styleborderStyles
borderColorborder-colorcolors
borderTopborder-topborders
borderTopWidthborder-top-widthborderWidths
borderTopStyleborder-top-styleborderStyles
borderTopColorborder-top-colorcolors
borderRightborder-rightborders
borderEndborder-inline-endborders
borderRightWidthborder-right-widthborderWidths
borderEndWidthborder-inline-end-widthborderWidths
borderRightStyleborder-right-styleborderStyles
borderEndStyleborder-inline-end-styleborderStyles
borderRightColorborder-right-colorcolors
borderEndColorborder-inline-end-colorcolors
borderBottomborder-bottomborders
borderBottomWidthborder-bottom-widthborderWidths
borderBottomStyleborder-bottom-styleborderStyles
borderBottomColorborder-bottom-colorcolors
borderLeftborder-leftborders
borderStartborder-inline-startborders
borderLeftWidthborder-left-widthborderWidths
borderStartWidthborder-inline-start-widthborderWidths
borderLeftStyleborder-left-styleborderStyles
borderStartStyleborder-inline-start-styleborderStyles
borderLeftColorborder-left-colorcolors
borderStartColorborder-inline-start-colorcolors
borderXborder-left , border-rightborders
borderYborder-top , border-bottomborders

테두리 반경

jsx
import { Button } from "@chakra-ui/react"
// 이 버튼은 오른쪽 borderRadius가 없습니다.
<Button borderRightRadius="0">Button 1</Button>
// 이 버튼은 왼쪽 borderRadius가 없습니다.
<Button borderLeftRadius="0">Button 2</Button>
// 왼쪽 상단과 오른쪽 상단 반경은 theme.radii.md => 4px가 됩니다.
<Button borderTopRadius="md">Button 2</Button>
jsx
import { Button } from "@chakra-ui/react"
// 이 버튼은 오른쪽 borderRadius가 없습니다.
<Button borderRightRadius="0">Button 1</Button>
// 이 버튼은 왼쪽 borderRadius가 없습니다.
<Button borderLeftRadius="0">Button 2</Button>
// 왼쪽 상단과 오른쪽 상단 반경은 theme.radii.md => 4px가 됩니다.
<Button borderTopRadius="md">Button 2</Button>
프롭CSS 프로퍼티테마 필드
borderRadiusborder-radiusradii
borderTopLeftRadiusborder-top-left-radiusradii
borderTopStartRadiusborder-top-left-radius in LTR,
border-top-right-radius in RTL
radii
borderTopRightRadiusborder-top-right-radiusradii
borderTopEndRadiusborder-top-right-radius in LTR,
border-top-left-radius in RTL
radii
borderBottomRightRadiusborder-bottom-right-radiusradii
borderBottomEndRadiusborder-bottom-right-radius in LTR,
border-bottom-left-radius in RTL
radii
borderBottomLeftRadiusborder-bottom-left-radiusradii
borderBottomStartRadiusborder-bottom-left-radius in LTR,
border-bottom-left-radius in RTL
radii
borderTopRadiusborder-top-left-radius + border-top-right-radiusradii
borderRightRadiusborder-top-right-radius + border-bottom-right-radiusradii
borderEndRadiusborder-top-right-radius + border-bottom-right-radiusradii
borderBottomRadiusborder-bottom-left-radius + border-bottom-right-radiusradii
borderLeftRadiusborder-top-left-radius + border-bottom-left-radiusradii
borderStartRadiusborder-top-left-radius + border-bottom-left-radiusradii

위치

jsx
import { Box } from "@chakra-ui/react"
// 장황함
<Box position="absolute">Cover</Box>
// 약칭
<Box pos="absolute">Cover</Box>
<Box pos="absolute" top="0" left="0">
Absolute with top and left
</Box>
<Box pos="fixed" w="100%" zIndex={2}>
Fixed with zIndex
</Box>
jsx
import { Box } from "@chakra-ui/react"
// 장황함
<Box position="absolute">Cover</Box>
// 약칭
<Box pos="absolute">Cover</Box>
<Box pos="absolute" top="0" left="0">
Absolute with top and left
</Box>
<Box pos="fixed" w="100%" zIndex={2}>
Fixed with zIndex
</Box>
프롭CSS 프로퍼티테마 필드
pos, positionposition없음
zIndexz-indexzIndices
toptopspace
rightrightspace
bottombottomspace
leftleftspace

그림자

jsx
<SimpleGrid
bg='gray.50'
columns={{ sm: 2, md: 4 }}
spacing='8'
p='10'
textAlign='center'
rounded='lg'
color='gray.400'
>
<Box boxShadow='xs' p='6' rounded='md' bg='white'>
xs
</Box>
<Box boxShadow='sm' p='6' rounded='md' bg='white'>
sm
</Box>
<Box boxShadow='base' p='6' rounded='md' bg='white'>
Base
</Box>
<Box boxShadow='md' p='6' rounded='md' bg='white'>
md
</Box>
<Box boxShadow='lg' p='6' rounded='md' bg='white'>
lg
</Box>
<Box boxShadow='xl' p='6' rounded='md' bg='white'>
xl
</Box>
<Box boxShadow='2xl' p='6' rounded='md' bg='white'>
2xl
</Box>
<Box boxShadow='dark-lg' p='6' rounded='md' bg='white'>
Dark lg
</Box>
<Box boxShadow='outline' p='6' rounded='md' bg='white'>
Outline
</Box>
<Box boxShadow='inner' p='6' rounded='md' bg='white'>
Inner
</Box>
</SimpleGrid>
jsx
<SimpleGrid
bg='gray.50'
columns={{ sm: 2, md: 4 }}
spacing='8'
p='10'
textAlign='center'
rounded='lg'
color='gray.400'
>
<Box boxShadow='xs' p='6' rounded='md' bg='white'>
xs
</Box>
<Box boxShadow='sm' p='6' rounded='md' bg='white'>
sm
</Box>
<Box boxShadow='base' p='6' rounded='md' bg='white'>
Base
</Box>
<Box boxShadow='md' p='6' rounded='md' bg='white'>
md
</Box>
<Box boxShadow='lg' p='6' rounded='md' bg='white'>
lg
</Box>
<Box boxShadow='xl' p='6' rounded='md' bg='white'>
xl
</Box>
<Box boxShadow='2xl' p='6' rounded='md' bg='white'>
2xl
</Box>
<Box boxShadow='dark-lg' p='6' rounded='md' bg='white'>
Dark lg
</Box>
<Box boxShadow='outline' p='6' rounded='md' bg='white'>
Outline
</Box>
<Box boxShadow='inner' p='6' rounded='md' bg='white'>
Inner
</Box>
</SimpleGrid>
jsx
<Text textShadow='1px 1px #ff0000' m='6'>
Text with shadows
</Text>
jsx
<Text textShadow='1px 1px #ff0000' m='6'>
Text with shadows
</Text>
프롭CSS 프로퍼티테마 필드
textShadowtext-shadowshadows
shadow, boxShadowbox-shadowshadows

필터

jsx
function Filters() {
const basicBoxStyles = {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
textAlign: 'center',
boxSize: '250px',
color: 'white',
textShadow: '0 0 20px black',
fontWeight: 'bold',
fontSize: '20px',
px: 4,
background:
'url(https://picsum.photos/id/1080/200/300) center/cover no-repeat',
}
return (
<Flex flexWrap='wrap' gap='24px' justifyContent='space-evenly'>
{/* 요소에 filter 프로퍼티 추가하기 */}
<Box sx={basicBoxStyles} filter='grayscale(80%)'>
Box with Filter
</Box>
{/* 요소에 blur 프로퍼티 추가하기 */}
<Box sx={basicBoxStyles} filter='auto' blur='2px'>
Box with Blur
</Box>
{/* 요소에 brightness 프로퍼티 추가하기 */}
<Box sx={basicBoxStyles} filter='auto' brightness='40%'>
Box with Brightness
</Box>
</Flex>
)
}
jsx
function Filters() {
const basicBoxStyles = {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
textAlign: 'center',
boxSize: '250px',
color: 'white',
textShadow: '0 0 20px black',
fontWeight: 'bold',
fontSize: '20px',
px: 4,
background:
'url(https://picsum.photos/id/1080/200/300) center/cover no-repeat',
}
return (
<Flex flexWrap='wrap' gap='24px' justifyContent='space-evenly'>
{/* 요소에 filter 프로퍼티 추가하기 */}
<Box sx={basicBoxStyles} filter='grayscale(80%)'>
Box with Filter
</Box>
{/* 요소에 blur 프로퍼티 추가하기 */}
<Box sx={basicBoxStyles} filter='auto' blur='2px'>
Box with Blur
</Box>
{/* 요소에 brightness 프로퍼티 추가하기 */}
<Box sx={basicBoxStyles} filter='auto' brightness='40%'>
Box with Brightness
</Box>
</Flex>
)
}
참고

요소에 blur, brightness, contrast, hueRotate, invert, saturate 프롭을 적용하려면, filter 프롭의 값을 auto로 지정합니다.

jsx
function BackdropFilters() {
const outerBoxStyles = {
boxSize: '250px',
p: '10',
background:
'url(https://picsum.photos/id/1068/200/300) center/cover no-repeat',
}
const innerBoxStyles = {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
textAlign: 'center',
boxSize: 'full',
color: 'white',
textShadow: '0 0 20px black',
fontWeight: 'bold',
fontSize: '20px',
}
return (
<Flex flexWrap='wrap' gap='24px' justifyContent='space-evenly'>
{/* 요소에 backdrop-filter 프로퍼티 추가하기 */}
<Box sx={outerBoxStyles}>
<Box sx={innerBoxStyles} backdropFilter='invert(100%)'>
Box with Backdrop Filter
</Box>
</Box>
{/* 요소에 backdrop-blur 프로퍼티 추가하기 */}
<Box sx={outerBoxStyles}>
<Box sx={innerBoxStyles} backdropFilter='auto' backdropBlur='8px'>
Box with Backdrop Blur
</Box>
</Box>
{/* 요소에 backdrop-contrast 프로퍼티 추가하기 */}
<Box sx={outerBoxStyles}>
<Box sx={innerBoxStyles} backdropFilter='auto' backdropContrast='30%'>
Box with Backdrop Contrast
</Box>
</Box>
</Flex>
)
}
jsx
function BackdropFilters() {
const outerBoxStyles = {
boxSize: '250px',
p: '10',
background:
'url(https://picsum.photos/id/1068/200/300) center/cover no-repeat',
}
const innerBoxStyles = {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
textAlign: 'center',
boxSize: 'full',
color: 'white',
textShadow: '0 0 20px black',
fontWeight: 'bold',
fontSize: '20px',
}
return (
<Flex flexWrap='wrap' gap='24px' justifyContent='space-evenly'>
{/* 요소에 backdrop-filter 프로퍼티 추가하기 */}
<Box sx={outerBoxStyles}>
<Box sx={innerBoxStyles} backdropFilter='invert(100%)'>
Box with Backdrop Filter
</Box>
</Box>
{/* 요소에 backdrop-blur 프로퍼티 추가하기 */}
<Box sx={outerBoxStyles}>
<Box sx={innerBoxStyles} backdropFilter='auto' backdropBlur='8px'>
Box with Backdrop Blur
</Box>
</Box>
{/* 요소에 backdrop-contrast 프로퍼티 추가하기 */}
<Box sx={outerBoxStyles}>
<Box sx={innerBoxStyles} backdropFilter='auto' backdropContrast='30%'>
Box with Backdrop Contrast
</Box>
</Box>
</Flex>
)
}
주의

backdrop-filter는 파이어폭스에서 지원되지 않습니다. 사용자가 활성화할 수 있지만, 해당 프로퍼티의 유무에 상관없이 보기 좋은 컴포넌트를 설계하는 것이 좋습니다.

참고

요소에 backdropBlur, backdropBrightness, backdropContrast, backdropHueRotate, backdropInvert, backdropSaturate 프롭을 적용하려면, backdropFilter 프롭의 값을 auto로 지정합니다.

프롭CSS 프로퍼티테마 필드
filterfilter없음
blurfilterblur
brightnessfilter없음
contrastfilter없음
hueRotatefilter없음
invertfilter없음
saturatefilter없음
dropShadowfiltershadows
backdropFilterbackdrop-filter없음
backdropBlurbackdrop-filterblur
backdropBrightnessbackdrop-filter없음
backdropContrastbackdrop-filter없음
backdropHueRotatebackdrop-filter없음
backdropInvertbackdrop-filter없음
backdropSaturatebackdrop-filter없음

의사

jsx
import { Button } from "@chakra-ui/react"
// :hover 스타일
<Button
colorScheme="teal"
_hover={{
background: "white",
color: "teal.500",
}}
>
Hover me
</Button>
// 부모 요소에 :hover를 적용합니다.
<Box
role="group"
>
<Box
_hover={{ fontWeight: 'semibold' }}
_groupHover={{ color: 'tomato' }}
>
</Box>
</Box>
// ::before 의사 요소를 추가합니다.
// 콘텐츠 값에는 추가 따옴표가 필요하다는 것을 유의하세요.
<Box
_before={{ content: '"🙂"', display: 'inline-block', mr: '5px' }}
>
A pseudo element
</Box>
jsx
import { Button } from "@chakra-ui/react"
// :hover 스타일
<Button
colorScheme="teal"
_hover={{
background: "white",
color: "teal.500",
}}
>
Hover me
</Button>
// 부모 요소에 :hover를 적용합니다.
<Box
role="group"
>
<Box
_hover={{ fontWeight: 'semibold' }}
_groupHover={{ color: 'tomato' }}
>
</Box>
</Box>
// ::before 의사 요소를 추가합니다.
// 콘텐츠 값에는 추가 따옴표가 필요하다는 것을 유의하세요.
<Box
_before={{ content: '"🙂"', display: 'inline-block', mr: '5px' }}
>
A pseudo element
</Box>
프롭CSS 프로퍼티테마 필드
_hover&:hover
&[data-hover]
없음
_active&:active
&[data-active]
없음
_focus&:focus
&[data-focus]
없음
_highlighted&[data-highlighted]없음
_focusWithin&:focus-within없음
_focusVisible&:focus-visible없음
_disabled&[disabled]
&[aria-disabled=true]
&[data-disabled]
없음
_readOnly&[aria-readonly=true]
&[readonly]
&[data-readonly]
없음
_before&::before없음
_after&::after없음
_empty&:empty없음
_expanded&[aria-expanded=true]
&[data-expanded]
없음
_checked&[aria-checked=true]
&[data-checked]
없음
_grabbed&[aria-grabbed=true]
&[data-grabbed]
없음
_pressed&[aria-pressed=true]
&[data-pressed]
없음
_invalid&[aria-invalid=true]
&[data-invalid]
없음
_valid&[data-valid]
&[data-state=valid]
없음
_loading&[data-loading]
&[aria-busy=true]
없음
_selected&[aria-selected=true]
&[data-selected]
없음
_hidden&[hidden]
&[data-hidden]
없음
_autofill&:-webkit-autofill없음
_even&:nth-of-type(even)없음
_odd&:nth-of-type(odd)없음
_first&:first-of-type없음
_last&:last-of-type없음
_notFirst&:not(:first-of-type)없음
_notLast&:not(:last-of-type)없음
_visited&:visited없음
_activeLink&[aria-current=page]없음
_activeStep&[aria-current=step]없음
_indeterminate&:indeterminate
&[aria-checked=mixed]
&[data-indeterminate]
없음
_groupHover[role=group]:hover &
[role=group][data-hover] &
[data-group]:hover &
[data-group][data-hover] &
.group:hover &
.group[data-hover] &
없음
_peerHover[data-peer]:hover ~ &
[data-peer][data-hover] ~ &
.peer:hover ~ &
.peer[data-hover] ~ &
없음
_groupFocus[role=group]:focus &
[role=group][data-focus] &
[data-group]:focus &
[data-group][data-focus] &
.group:focus &
.group[data-focus] &
없음
_peerFocus[data-peer]:focus ~ &
[data-peer][data-focus] ~ &
.peer:focus ~ &
.peer[data-focus] ~ &
없음
_groupFocusVisible[role=group]:focus-visible &
[data-group]:focus-visible &
.group:focus-visible &
없음
_peerFocusVisible[data-peer]:focus-visible ~ &
.peer:focus-visible ~ &
없음
_groupActive[role=group]:active &
[role=group][data-active] &
[data-group]:active &
[data-group][data-active] &
.group:active &
.group[data-active] &
없음
_peerActive[data-peer]:active ~ &
[data-peer][data-active] ~ &
.peer:active ~ &
.peer[data-active] ~ &
없음
_groupDisabled[role=group]:disabled &
[role=group][data-disabled] &
[data-group]:disabled &
[data-group][data-disabled] &
.group:disabled &
.group[data-disabled] &
없음
_peerDisabled[data-peer]:disabled ~ &
[data-peer][data-disabled] ~ &
.peer:disabled ~ &
.peer[data-disabled] ~ &
없음
_groupInvalid[role=group]:invalid &
[role=group][data-invalid] &
[data-group]:invalid &
[data-group][data-invalid] &
.group:invalid &
.group[data-invalid] &
없음
_peerInvalid[data-peer]:invalid ~ &
[data-peer][data-invalid] ~ &
.peer:invalid ~ &
.peer[data-invalid] ~ &
없음
_groupChecked[role=group]:checked &
[role=group][data-checked] &
[data-group]:checked &
[data-group][data-checked] &
.group:checked &
.group[data-checked] &
없음
_peerChecked[data-peer]:checked ~ &
[data-peer][data-checked] ~ &
.peer:checked ~ &
.peer[data-checked] ~ &
없음
_groupFocusWithin[role=group]:focus-within &
[data-group]:focus-within &
.group:focus-within &
없음
_peerFocusWithin[data-peer]:focus-within ~ &
.peer:focus-within ~ &
없음
_peerPlaceholderShown[data-peer]:placeholder-shown ~ &
.peer:placeholder-shown ~ &
없음
_placeholder&::placeholder없음
_placeholderShown&:placeholder-shown없음
_fullScreen&:fullscreen없음
_selection&::selection없음
_rtl[dir=rtl] &
&[dir=rtl]
없음
_ltr[dir=ltr] &
&[dir=ltr]
없음
_mediaDark@media (prefers-color-scheme: dark)없음
_mediaReduceMotion@media (prefers-reduced-motion: reduce)없음
_dark.chakra-ui-dark &
[data-theme=dark] &
&[data-theme=dark]
없음
_light.chakra-ui-light &
[data-theme=light] &
&[data-theme=light]
없음

기타 프롭

위에 나열된 모든 공통 스타일 프롭을 제외하고, 모든 컴포넌트는 다음 프롭을 허용합니다.

프롭CSS 프로퍼티테마 필드
animationanimation없음
appearanceappearance없음
contentcontent없음
transformtransform없음
transformOrigintransform-origin없음
visibilityvisibility없음
whiteSpacewhite-space없음
userSelectuser-select없음
pointerEventspointer-events없음
wordBreakword-break없음
overflowWrapoverflow-wrap없음
textOverflowtext-overflow없음
boxSizingbox-sizing없음
cursorcursor없음
resizeresize없음
transitiontransition없음
objectFitobject-fit없음
objectPositionobject-position없음
floatfloat없음
fillfillcolors
strokestrokecolors
outlineoutline없음

as 프롭

as 프롭을 이용하면 렌더링할 HTML 태그 또는 컴포넌트를 전달할 수 있습니다. 모든 컴포넌트에서 사용 가능합니다.

예를 들어 Button 컴포넌트를 링크로 사용하고 싶다고 가정해 보겠습니다. aButton을 다음과 같이 구성할 수 있습니다.

jsx
<Button as='a' target='_blank' variant='outline' href='https://chakra-ui.com'>
Hello
</Button>
jsx
<Button as='a' target='_blank' variant='outline' href='https://chakra-ui.com'>
Hello
</Button>

이를 통해 버튼을 a 컴포넌트로 감싸지 않고도 모든 Button 프롭과 a 프롭을 사용할 수 있게 됩니다.