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

Tag 태그

원문 보기 위키 갱신

Tag는 내용에 꼬리표를 달거나 분류할 때 쓰는 라벨 컴포넌트예요.

출처: 문서

본문

설치

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

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

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

사용 예시

기본 사용법

demo: tag basic

스타일

demo: tag custom

색상 커스터마이즈

demo: tag color

API

Props

Attribute Description Type Default
type Label type,can be set primary success danger warning、default string default
color Label color string -
text-color Text color, which takes precedence over the color attribute string white
plain Whether it is plain boolean false
round Whether it is round boolean false
mark Whether it is mark boolean false
closeable Whether it is a closeable tag boolean false

Slots

Name Description
default Label display content

Events

Event Description Arguments
click click event event
close close event event

Types v4.3.3

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

import type { TagType, TagProps, TagInstance } from '@nutui/nutui';

Theming

CSS Variables

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

Name Default Value
--nut-tag-font-size 12px
--nut-tag-default-border-radius 4px
--nut-tag-round-border-radius 8px
--nut-tag-default-background-color #000000
--nut-tag-primary-background-color #3460fa
--nut-tag-success-background-color #4fc08d
--nut-tag-danger-background-color linear-gradient(135deg,rgba(242, 20, 12, 1) 0%,rgba(232, 34, 14, 1) 70%,rgba(242, 77, 12, 1) 100%)
--nut-tag-danger-background-color-plain #df3526
--nut-tag-warning-background-color #f3812e
--nut-tag-default-color #ffffff
--nut-tag-border-width 1px
--nut-tag-plain-background-color #fff
--nut-tag-height auto

더 알아보기 (Learn more)