본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

프로퍼티

원문 보기 위키 갱신

프로퍼티 (Properties)

이 API 페이지는 MUI System의 커스텀 프로퍼티 전체를 정리해 둔 곳이에요. 프로퍼티가 테마와 어떻게 연결되는지, 어떤 CSS 프로퍼티를 계산해 내는지 한눈에 볼 수 있어요.

출처: 문서

본문

이 페이지는 커스텀 프로퍼티를 정리하고 있지만, MUI System은 CSS의 상위 집합(superset)으로 설계되었어요. 그래서 일반적인 CSS 프로퍼티와 선택자(selector)도 모두 지원돼요.

프로퍼티 참조 테이블

이 테이블은 커스텀 프로퍼티만 나열한다는 점에 주의하세요. 그 외의 일반 CSS 프로퍼티와 선택자도 모두 지원돼요. 아래에 있는 범례(legend)를 참고하면 돼요.

System key(s) CSS property/properties System style function Theme mapping
border border border ${value}px solid
borderBottom border-bottom borderBottom ${value}px solid
borderColor border-color borderColor theme.palette[value]
borderLeft border-left borderLeft ${value}px solid
borderRadius border-radius borderRadius theme.shape.borderRadius * value
borderRight border-right borderRight ${value}px solid
borderTop border-top borderTop ${value}px solid
boxShadow box-shadow boxShadow theme.shadows[value]
displayPrint display displayPrint none
display display displayRaw none
alignContent align-content alignContent none
alignItems align-items alignItems none
alignSelf align-self alignSelf none
flex flex flex none
flexDirection flex-direction flexDirection none
flexGrow flex-grow flexGrow none
flexShrink flex-shrink flexShrink none
flexWrap flex-wrap flexWrap none
justifyContent justify-content justifyContent none
order order order none
gap gap gap theme.spacing(value)
columnGap column-gap columnGap theme.spacing(value)
rowGap row-gap rowGap theme.spacing(value)
gridColumn grid-column gridColumn none
gridRow grid-row gridRow none
gridAutoFlow grid-auto-flow gridAutoFlow none
gridAutoColumns grid-auto-columns gridAutoColumns none
gridAutoRows grid-auto-rows gridAutoRows none
gridTemplateColumns grid-template-columns gridTemplateColumns none
gridTemplateRows grid-template-rows gridTemplateRows none
gridTemplateAreas grid-template-areas gridTemplateAreas none
gridArea grid-area gridArea none
bgcolor background-color bgcolor theme.palette[value]
color color color theme.palette[value]
bottom bottom bottom none
left left left none
position position position none
right right right none
top top top none
zIndex z-index zIndex theme.zIndex[value]
height height height none
maxHeight max-height maxHeight none
maxWidth max-width maxWidth none
minHeight min-height minHeight none
minWidth min-width minWidth none
width width width none
boxSizing box-sizing boxSizing none
m, margin margin spacing theme.spacing(value)
mb, marginBottom margin-bottom spacing theme.spacing(value)
ml, marginLeft margin-left spacing theme.spacing(value)
mr, marginRight margin-right spacing theme.spacing(value)
mt, marginTop margin-top spacing theme.spacing(value)
mx, marginX margin-left, margin-right spacing theme.spacing(value)
my, marginY margin-top, margin-bottom spacing theme.spacing(value)
marginInline margin-inline spacing theme.spacing(value)
marginInlineStart margin-inline-start spacing theme.spacing(value)
marginInlineEnd margin-inline-end spacing theme.spacing(value)
marginBlock margin-block spacing theme.spacing(value)
marginBlockStart margin-block-start spacing theme.spacing(value)
marginBlockEnd margin-block-end spacing theme.spacing(value)
p, padding padding spacing theme.spacing(value)
pb, paddingBottom padding-bottom spacing theme.spacing(value)
pl, paddingLeft padding-left spacing theme.spacing(value)
pr, paddingRight padding-right spacing theme.spacing(value)
pt, paddingTop padding-top spacing theme.spacing(value)
px, paddingX padding-left, padding-right spacing theme.spacing(value)
py, paddingY padding-top, padding-bottom spacing theme.spacing(value)
paddingInline padding-inline spacing theme.spacing(value)
paddingInlineStart padding-inline-start spacing theme.spacing(value)
paddingInlineEnd padding-inline-end spacing theme.spacing(value)
paddingBlock padding-block spacing theme.spacing(value)
paddingBlockStart padding-block-start spacing theme.spacing(value)
paddingBlockEnd padding-block-end spacing theme.spacing(value)
typography font-family, font-weight, font-size, line-height, letter-spacing, text-transform typography theme.typography[value]
fontFamily font-family fontFamily theme.typography[value]
fontSize font-size fontSize theme.typography[value]
fontStyle font-style fontStyle theme.typography[value]
fontWeight font-weight fontWeight theme.typography[value]
letterSpacing letter-spacing letterSpacing theme.typography[value]
lineHeight line-height lineHeight theme.typography[value]
textAlign text-align textAlign none

범례 (Legend)

위 테이블에서 한 줄을 예로 들어볼게요:

System key(s) CSS property/properties System style function Theme mapping
mb, marginBottom margin-bottom spacing theme.spacing(value)

각 컬럼을 하나씩 자세히 살펴볼게요:

  • System keys. 이 컬럼은 sx prop으로 이 프로퍼티를 사용할 때 쓰는 키(key)들을 나열해요.

    <Button sx={{ mb: 3 }}>
    // or
    <Box sx={{ mb: 3 }}>
    // or
    <Box sx={{ marginBottom: 3 }}>
    
  • CSS properties. 이 컬럼은 이 시스템 프로퍼티를 사용하면 어떤 CSS 프로퍼티가 생성되는지 설명해요.

    .my-class {
      margin-bottom: Xpx;
    }
    
  • System style function. 이 컬럼은 다른 컬럼들에 나온 프로퍼티를 만들어내는 함수를 나열해요. 이 기능을 커스텀 컴포넌트에 추가하고 싶을 때 참고하면 돼요. 이 함수들은 @mui/system에서 import 할 수 있어요. 스타일 함수 사용 예시는 Custom components 페이지에서 볼 수 있어요. 컬럼의 링크는 이 프로퍼티들이 설명된 문서 페이지(이 예시에서는 spacing 페이지)로 연결돼요.

  • Theme mapping. 마지막으로, 이 컬럼은 이 프로퍼티가 테마와 어떻게 연결되는지 알려줘요. 이 예시에서는 어떤 값을 넣든 그 값이 theme.spacing 헬퍼의 입력값으로 쓰여요.

예시를 하나 살펴볼게요:

<Button sx={{ mb: 3 }} />

// is equivalent to
<Button sx={{ marginBottom: theme => theme.spacing(3)}} />

기본 테마의 spacing이 8px이기 때문에, 결과적으로 다음 CSS 클래스가 만들어져요:

.my-class {
  margin-bottom: 24px;
}

더 알아보기 (Learn more)