Grid
Grid 컴포넌트는 CSS Grid를 사용하며 디자인 토큰을 JSX에서 사용할 수 있도록 도와줍니다.
Props
Grid
Prop
Type
background?ScopedColorBanner | ScopedColorBg | ScopedColorPalette | (string & {}) | undefinedbackgroundGradient?"fadeMask" | "glowMagic" | "glowMagicPressed" | "highlightMagic" | "highlightMagicPressed" | "shimmerMagic" | "shimmerNeutral" | undefinedcolor?ScopedColorFg | ScopedColorPalette | (string & {}) | undefinedborderColor?ScopedColorPalette | ScopedColorStroke | (string & {}) | undefinedborderWidth?0 | 1 | (string & {}) | undefinedborderTopWidth?0 | 1 | (string & {}) | undefinedborderRightWidth?0 | 1 | (string & {}) | undefinedborderBottomWidth?0 | 1 | (string & {}) | undefinedborderLeftWidth?0 | 1 | (string & {}) | undefinedborderRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefinedborderTopLeftRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefinedborderTopRightRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefinedborderBottomRightRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefinedborderBottomLeftRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefinedboxShadow?"s1" | "s2" | "s3" | (string & {}) | undefinedwidth?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefinedminWidth?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefinedmaxWidth?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefinedheight?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefinedminHeight?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefinedmaxHeight?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefinedtop?0 | (string & {}) | undefinedleft?0 | (string & {}) | undefinedright?0 | (string & {}) | undefinedbottom?0 | (string & {}) | undefinedpadding?ResponsiveValue<"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefinedpaddingX?ResponsiveValue<"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefinedpaddingY?ResponsiveValue<"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefinedpaddingTop?ResponsiveValue<"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefinedpaddingRight?ResponsiveValue<"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefinedpaddingBottom?ResponsiveValue<"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefinedpaddingLeft?ResponsiveValue<"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefinedposition?"absolute" | "fixed" | "relative" | "sticky" | undefinedoverflowX?"auto" | "hidden" | "scroll" | "visible" | undefinedoverflowY?"auto" | "hidden" | "scroll" | "visible" | undefinedzIndex?number | (string & {}) | undefinedflexDirection?ResponsiveValue<"column" | "column-reverse" | "row" | "row-reverse"> | undefinedjustifyContent?"center" | "flex-end" | "flex-start" | "space-around" | "space-between" | undefinedalignItems?"center" | "flex-end" | "flex-start" | "stretch" | undefinedalignContent?"center" | "flex-end" | "flex-start" | "stretch" | undefinedalignSelf?"center" | "flex-end" | "flex-start" | "stretch" | undefinedgap?ResponsiveValue<"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefinedgridColumn?string | undefinedgridRow?string | undefinedunstable_transform?string | undefined_active?{ bg?: ScopedColorBg | ScopedColorPalette | (string & {}); background?: ScopedColorBg | ScopedColorPalette | (string & {}); } | undefinedas?React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefinedasChild?boolean | undefinedhideFrom?BreakpointThreshold | undefinedjustifyItems?"center" | "flex-end" | "flex-start" | "stretch" | undefinedGridItem
GridItem은 Grid 컨테이너 내에서 아이템의 배치를 제어하는 컴포넌트입니다. Grid 내부의 모든 아이템이 GridItem일 필요는 없습니다.
Prop
Type
background?ScopedColorBanner | ScopedColorBg | ScopedColorPalette | (string & {}) | undefinedbackgroundGradient?"fadeMask" | "glowMagic" | "glowMagicPressed" | "highlightMagic" | "highlightMagicPressed" | "shimmerMagic" | "shimmerNeutral" | undefinedcolor?ScopedColorFg | ScopedColorPalette | (string & {}) | undefinedborderColor?ScopedColorPalette | ScopedColorStroke | (string & {}) | undefinedborderWidth?0 | 1 | (string & {}) | undefinedborderTopWidth?0 | 1 | (string & {}) | undefinedborderRightWidth?0 | 1 | (string & {}) | undefinedborderBottomWidth?0 | 1 | (string & {}) | undefinedborderLeftWidth?0 | 1 | (string & {}) | undefinedborderRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefinedborderTopLeftRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefinedborderTopRightRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefinedborderBottomRightRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefinedborderBottomLeftRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefinedboxShadow?"s1" | "s2" | "s3" | (string & {}) | undefinedwidth?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefinedminWidth?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefinedmaxWidth?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefinedheight?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefinedminHeight?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefinedmaxHeight?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefinedtop?0 | (string & {}) | undefinedleft?0 | (string & {}) | undefinedright?0 | (string & {}) | undefinedbottom?0 | (string & {}) | undefinedpadding?ResponsiveValue<"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefinedpaddingX?ResponsiveValue<"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefinedpaddingY?ResponsiveValue<"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefinedpaddingTop?ResponsiveValue<"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefinedpaddingRight?ResponsiveValue<"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefinedpaddingBottom?ResponsiveValue<"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefinedpaddingLeft?ResponsiveValue<"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefineddisplay?ResponsiveValue<"block" | "flex" | "grid" | "inline" | "inline-block" | "inline-flex" | "none"> | undefinedposition?"absolute" | "fixed" | "relative" | "sticky" | undefinedoverflowX?"auto" | "hidden" | "scroll" | "visible" | undefinedoverflowY?"auto" | "hidden" | "scroll" | "visible" | undefinedzIndex?number | (string & {}) | undefinedflexDirection?ResponsiveValue<"column" | "column-reverse" | "row" | "row-reverse"> | undefinedjustifyContent?"center" | "flex-end" | "flex-start" | "space-around" | "space-between" | undefinedalignItems?"center" | "flex-end" | "flex-start" | "stretch" | undefinedalignContent?"center" | "flex-end" | "flex-start" | "stretch" | undefinedalignSelf?"center" | "flex-end" | "flex-start" | "stretch" | undefinedgap?ResponsiveValue<"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefinedunstable_transform?string | undefined_active?{ bg?: ScopedColorBg | ScopedColorPalette | (string & {}); background?: ScopedColorBg | ScopedColorPalette | (string & {}); } | undefinedas?React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefinedhideFrom?BreakpointThreshold | undefinedColumns and Rows
<Grid>의 columns 또는 rows prop에 number를 지정하여 grid-template-columns 또는 grid-template-rows를 repeat(${columns|rows}, minmax(0, 1fr))로 설정할 수 있습니다.
<Grid>의 columns 또는 rows에 grid-template-columns 또는 grid-template-rows 값을 직접 지정할 수도 있습니다.
Spanning Items
<GridItem>을 활용하여 그리드 아이템이 여러 열이나 행을 차지하도록 할 수 있습니다.
colSpan또는colStart,colEndprop으로 열 span을 지정합니다.colSpan="full"을 전달하면 행 전체 (좌우 양 끝)을 차지합니다.rowSpan또는rowStart,rowEndprop으로 행 span을 지정합니다.rowSpan="full"을 전달하면 열 전체 (상하 양 끝)을 차지합니다.
Auto Flow
<Grid>의 autoFlow prop을 사용하여 아이템이 배치되는 방향을 지정할 수 있습니다.
Auto Rows / Columns
<Grid>의 autoRows 또는 autoColumns prop을 사용하여 암시적으로 생성되는 행이나 열의 크기를 지정할 수 있습니다. 동적으로 아이템이 추가되는 그리드에서 유용합니다.
Using asChild Prop
GridItem은 asChild prop을 사용하여 자식 요소에 직접 grid 속성을 적용할 수 있습니다.
Composition
asChild prop에 대해 자세히 알아봅니다.
Using Box for Grid Item Placement
GridItem은 내부적으로 colSpan, colStart, colEnd, rowSpan, rowStart, rowEnd prop을 gridColumn 및 gridRow 스타일로 변환하여 Box에 적용합니다.
따라서 Box 컴포넌트에서 gridColumn, gridRow prop을 직접 사용할 수도 있습니다.
Responsive Design
Responsive Design
Grid의 columns, rows, gap 등에 반응형 값을 전달하여 viewport 크기에 따라 레이아웃을 조정할 수 있습니다.
Last updated on