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

Grid 격자

원문 보기 위키 갱신

Grid는 콘텐츠를 균등한 너비의 블록으로 나눠 페이지 내비게이션을 구성할 때 쓰는 컴포넌트예요.

출처: 문서

설치

Grid와 함께 GridItem도 앱에 등록해야 블록을 구성할 수 있어요.

import { createApp } from 'vue'
import { Grid, GridItem } from '@nutui/nutui'

const app = createApp()
app.use(Grid)
app.use(GridItem)

사용 예시

기본 사용법

demo: grid basic

컬럼 수

demo: grid column

정사각형

demo: grid square

간격(gutter)

demo: grid gutter

뒤집기

demo: grid reverse

가로 배치

demo: grid horizontal

콘텐츠 커스터마이즈

demo: grid content

API

Grid Props

Attribute Description Type 默认值
column-num Column Num number | string 4
border Whether to show border boolean true
gutter Gutter,The default unit is px number | string 0
center Whether to center content boolean true
square Whether to be square shape boolean false
reverse Whether to reverse the position of icon and text boolean false
direction Content arrangement direction, can be set to horizontal string vertical
clickable Whether to show click feedback when clicked boolean false

GridItem Props

Attribute Description Type Default
text text string -

GridItem Slots

Name Description
default Custom content
text Custom text

GridItem Events

Event Description Arguments
click Emitted when component is clicked event: Event

Types v4.3.6

이 컴포넌트는 아래 타입 정의를 함께 내보내요.

import type {
  GridDirection,
  GridProps,
  GridInstance
} from '@nutui/nutui';

Theming

CSS Variables

스타일 커스텀에 쓸 수 있는 CSS 변수를 제공해요. 자세한 내용은 ConfigProvider 컴포넌트를 참고하세요.

Name Default Value
--nut-grid-border-color #f5f6f7
--nut-grid-item-content-padding 16px 8px
--nut-grid-item-content-bg-color var(--nut-white)
--nut-grid-item-text-margin 8px
--nut-grid-item-text-color var(--nut-title-color2)
--nut-grid-item-text-font-size var(--nut-font-size-1)

더 알아보기 (Learn more)