Featuring Design System
Legacy

CoreTag

레거시 태그 컴포넌트. Tag로 마이그레이션을 권장합니다.

개요

마이그레이션 안내 — 이 컴포넌트는 레거시입니다. 신규 프로젝트에서는 Tag를 사용하세요.

CoreTag는 단일 props 기반 태그 컴포넌트입니다.

  • 10가지 tagTypeprimary, gray, red, orange, lightGreen, teal, blue, indigo, magenta, contrast
  • 3가지 sizexs, sm, md
  • 삭제 버튼onDelete prop으로 X 버튼 자동 생성
  • Hover 효과hoverEffect prop으로 활성화
  • Leading / Trailing element — 앞뒤에 아이콘 등 배치 가능

Usage

기본 사용법

<HStack $css={{ gap: '8px', flexWrap: 'wrap' }}>
<CoreTag tagType="primary" text="Primary" />
<CoreTag tagType="gray" text="Gray" />
<CoreTag tagType="red" text="Red" />
<CoreTag tagType="orange" text="Orange" />
<CoreTag tagType="lightGreen" text="LightGreen" />
<CoreTag tagType="teal" text="Teal" />
<CoreTag tagType="blue" text="Blue" />
<CoreTag tagType="indigo" text="Indigo" />
<CoreTag tagType="magenta" text="Magenta" />
<CoreTag tagType="contrast" text="Contrast" />
</HStack>

크기 설정

<HStack $css={{ gap: '8px', alignItems: 'center' }}>
<CoreTag tagType="primary" size="xs" text="xs" />
<CoreTag tagType="primary" size="sm" text="sm" />
<CoreTag tagType="primary" size="md" text="md" />
</HStack>

삭제 가능한 태그

() => {
const [tags, setTags] = React.useState(['React', 'TypeScript', 'Vanilla Extract']);
return (
  <HStack $css={{ gap: '8px' }}>
    {tags.map((tag) => (
      <CoreTag
        key={tag}
        tagType="primary"
        text={tag}
        onDelete={() => setTags((prev) => prev.filter((t) => t !== tag))}
      />
    ))}
  </HStack>
);
}

Leading Element와 Hover Effect

<HStack $css={{ gap: '8px' }}>
<CoreTag tagType="blue" text="정보" leadingElement={<IconInformationFilled />} />
<CoreTag tagType="primary" text="Hover 효과" hoverEffect />
</HStack>

비활성화 상태

<HStack $css={{ gap: '8px' }}>
<CoreTag tagType="primary" text="Disabled" disabled />
<CoreTag tagType="gray" text="Disabled" disabled />
</HStack>

Props

ComponentPropsWithoutRef<'div'>을 확장한 컴포넌트입니다.

Prop

Type

CoreTagType

Prop

Type

CoreTagSize

Prop

Type

스타일

Size Variants

SizeHeightPadding XPadding YTypography
xs20px4px2pxcaption[1]
sm22px6px2pxbody[1]
md26px8px4pxbody[1]

Tag Type — 상태별 토큰

tagTypetag-{type}-default (기본) / tag-{type}-hover (hover) 배경색 토큰을 사용합니다. Disabled 상태에서는 background[4] + text[4]로 통일됩니다.

마이그레이션 가이드

Tag는 Compound composition 패턴으로 레이아웃 구성이 유연합니다.

Before / After

// Before (CoreTag)
<CoreTag
  tagType="primary"
  size="md"
  text="React"
  leadingElement={<IconInformationFilled />}
  onDelete={() => handleDelete('React')}
/>
// After (Tag)
<Tag.Root tagType="primary" size="md">
  <Tag.Icon><IconInformationFilled /></Tag.Icon>
  <Tag.Text>React</Tag.Text>
  <Tag.RemoveButton onClick={() => handleDelete('React')} />
</Tag.Root>

변경 사항

CoreTagTag
text propTag.Text 서브컴포넌트
leadingElementTag.Icon 서브컴포넌트
onDeleteTag.RemoveButtononClick
hoverEffectTag.RoothoverEffect (동일)
disabledTag.Rootdisabled (동일)