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

Space 간격

원문 보기 위키 갱신

Space는 요소 사이의 간격을 잡아주는 컴포넌트예요. NutUI 4.2.0 이상에서 쓸 수 있어요.

출처: 문서

본문

설치

@nutui/nutui에서 컴포넌트를 가져와 앱에 등록하면 바로 쓸 수 있어요.

import { createApp } from 'vue'
import { Space } from '@nutui/nutui'

const app = createApp()
app.use(Space)

사용 예시

기본 사용법

Space 컴포넌트는 하위 컴포넌트 사이에 일정 간격을 만들어 줘요. 기본 간격은 8px예요.

demo: space basic

:::

방향 커스터마이즈

direction 속성을 vertical로 설정하면 세로 방향 간격을 잡을 수 있어요.

demo: space direction

간격(gutter) 커스터마이즈

gutter 값으로 간격 크기를 조절해요. 숫자를 넘기면 기본 단위로 px를 쓰고, 문자열로 2rem이나 5vw처럼 단위가 붙은 값도 넘길 수 있어요.

CSS 변수 -nut-space-gap으로도 설정할 수 있는데, 우선순위는 속성 > CSS 변수 > 기본 스타일 순이에요.

demo: space gutter

줄바꿈

가로 모드에서는 wrap 속성이 하위 요소를 자동으로 줄바꿈할지 결정해요.

demo: space wrap

API

Props

Property Description Type Default
direction Spacing direction, vertical horizontal string horizontal
align Cross axis alignment, start end center baseline string -
justify Spindle alignment, start end center between around evenly stretch string -
wrap Whether to wrap lines automatically. This parameter is valid only when horizontal boolean false
fill Whether to make Space a block-level element and fill the entire parent element boolean false
gutter Spacing size, such as 20px 2em, the default unit is px, and supports array form to set horizontal and vertical spacing respectively number | string | number[] | string[] -

Slots

Name Description
default Default slot

Theming

CSS Variables

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

Name Default Description
--nut-space-gap 8px Spacing size

더 알아보기 (Learn more)