On this page:

Tag

Preview

index.tsx
NeutralAccent
NeutralAccent
Tag-avatarJohn SmithTag-avatarJohn Smith
SmallMediumLarge
DisabledTag-avatarDisabledDisabledTag-avatarDisabled

Design Tokens for Tag

TokenColor forState/Meaning
--par-color-bg-tagTag backgroundDefault/Enabled
--par-color-bg-tag-hoveredTag backgroundHovered
--par-color-bg-tag-selectedTag backgroundSelected
--par-color-bg-tag-disabledTag backgroundDisabled
--par-color-border-tagTag borderAny
--par-color-text-tagTag textDefault/Enabled
--par-color-text-tag-disabledTag textDisabled
--par-color-icon-tagTag iconAny
--par-color-bg-tag-remove-hoveredRemove button backgroundHovered
--par-color-bg-tag-remove-pressedRemove button backgroundPressed
--par-color-bg-tag-remove-disabledRemove button backgroundDisabled
--par-color-text-tag-removeRemove button text/iconAny
--par-color-text-tag-remove-disabledRemove button text/iconDisabled

Tag API Reference

<Tag />

PropTypeDefaultDescription
labelstring(required)Tag label (nội dung hiển thị chính).
iconReactNodeIcon hoặc hình ảnh hiển thị bên trái label.
size'sm' | 'md' | 'lg''md'Kích thước của Tag.
kind'glass' | 'outlined''outlined'Kiểu hiển thị của Tag.
color'neutral' | 'accent''neutral'Màu sắc của Tag.
valuestring | numberGiá trị của Tag, dùng cho các trường hợp như checkbox, radio, dropdown, input.
disabledbooleanfalseVô hiệu hóa Tag.
onRemove(value: string | number) => voidCallback khi nhấn nút xóa (close).
...spanPropsHTMLSpanElement propsKế thừa tất cả props mặc định của thẻ <span> (className, style, ...).

Lưu ý: Tag luôn hiển thị nút xóa nếu có onRemove truyền vào. Tag kế thừa toàn bộ props của HTMLSpanElement.