Divider 구분선
Divider는 콘텐츠를 여러 영역으로 나눠주는 구분선 컴포넌트예요. 텍스트를 넣거나 점선으로 바꾸는 것도 간단해요.
출처: 문서
설치
@nutui/nutui에서 컴포넌트를 가져와 앱에 등록하면 바로 쓸 수 있어요.
import { createApp } from 'vue'
import { Divider } from '@nutui/nutui'
const app = createApp()
app.use(Divider)
사용 예시
기본 사용법
기본으로 가로 구분선 하나를 그려요.
demo: divider basic
텍스트 넣기
기본 슬롯으로 구분선 안에 텍스트를 넣을 수 있어요.
demo: divider text
콘텐츠 위치
content-position 속성으로 텍스트 위치를 정해요.
demo: divider position
점선
dashed 속성으로 점선 구분선을 그려요.
demo: divider dashed
스타일 커스터마이즈
style 속성으로 구분선 스타일을 직접 바꿀 수 있어요.
demo: divider custom
세로 구분선
demo: divider vertical
API
Props
| Attribute | Description | Type | Default |
|---|---|---|---|
| dashed | Whether to use dashed border | boolean | false |
| hairline | Whether to use hairline | boolean | true |
| content-position | Content position, can be set to left or right |
string | center |
| direction | The direction of divider, can to set to vertical |
string | horizontal |
Slots
| Name | Description |
|---|---|
| default | Default slot, when direction = horizontal |
Types v4.3.0
이 컴포넌트는 아래 타입 정의를 함께 내보내요.
import type {
DividerPosition,
DividerDirection,
DividerProps,
DividerInstance
} from '@nutui/nutui';
Theming
CSS Variables
스타일 커스텀에 쓸 수 있는 CSS 변수를 제공해요. 자세한 내용은 ConfigProvider 컴포넌트를 참고하세요.
| Name | Default Value |
|---|---|
| --nut-divider-margin | 16px 0 |
| --nut-divider-text-font-size | var(--nut-font-size-2) |
| --nut-divider-text-color | #909ca4 |
| --nut-divider-line-height | 2px |
| --nut-divider-before-margin-right | 16px |
| --nut-divider-after-margin-left | 16px |
| --nut-divider-vertical-height | 12px |
| --nut-divider-vertical-top | 2px |
| --nut-divider-vertical-border-left | rgba(0, 0, 0, 0.06) |
| --nut-divider-vertical-margin | 0 8px |
더 알아보기 (Learn more)
- 원문 문서: NutUI Divider 공식 문서(영문)
- NutUI는 JD.com이 공개한 Vue 3 모바일 컴포넌트 라이브러리예요. 전체 컴포넌트 목록은 공식 문서 사이트에서, 소스 코드는 GitHub 저장소에서 볼 수 있어요.