logoAnt Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
YouMindTRACTIANLobeHubCodeRabbit
6.5.0
  • Components Overview
  • Changelog
    v6.5.0
  • General
    • Button
    • FloatButton
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
    • Grid
    • Layout
    • Masonry
      6.0.0
    • Space
    • Splitter
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
    • Tabs
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
      DEPRECATED
    • Popover
    • QRCode
    • Segmented
    • Statistic
    • Table
    • Tag
    • Timeline
    • Tooltip
    • Tour
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
  • Other
    • Affix
    • App
    • BorderBeam
      6.4.0
    • ConfigProvider
    • Util
When To Use
Examples
Basic
Colorful Tag
Add & Remove Dynamically
Checkable
Animate
Icon
Status Tag
Draggable Tag
Custom semantic dom styling
API
Tag
Tag.CheckableTag
Tag.CheckableTagGroup
Semantic DOM
Tag
Tag.CheckableTagGroup
Design Token

Tag

Used for marking and categorization.
Importimport { Tag } from 'antd';
GitHub
components/tagIssueOpen issues
Docs
Edit this pageLLMs.md
TableTimeline

Resources

Ant Design X
Ant Design Charts
Ant Design Pro
Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Web3
Ant Design Landing-Landing Templates
Scaffolds-Scaffold Market
Umi-React Application Framework
dumi-Component doc generator
qiankun-Micro-Frontends Framework
Ant Motion-Motion Solution
China Mirror 🇨🇳

Community

Awesome Ant Design
Medium
X
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference

Help

GitHub
Change Log
FAQ
For Agents
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
WeaveFox logoWeaveFox-AI Development with WeaveFox 🦊
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community
loading

When To Use

  • It can be used to tag by dimension or property.

  • When categorizing.

Examples

API

Common props ref:Common props

Tag

PropertyDescriptionTypeDefaultVersionGlobal Config
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-6.0.0
closeIconCustom close icon. 5.7.0: close button will be hidden when setting to null or falseReactNodefalse4.4.05.14.0
colorColor of the Tagstringdefault when variant="solid"solid default color: 6.4.0×
disabledWhether the tag is disabledbooleanfalse6.0.0×
hrefThe address to jump when clicking, when this property is specified, the tag component will be rendered as an <a> tagstring-6.0.0×
iconSet the icon of tagReactNode-×
onCloseCallback executed when tag is closed (can be prevented by e.preventDefault())(e: React.MouseEvent<HTMLElement, MouseEvent>) => void-×
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-6.0.0
targetSame as target attribute of a, works when href is specifiedstring-6.0.0×
variantVariant of the tag'filled' | 'solid' | 'outlined''filled'6.0.06.0.0
borderedWhether has border style, please use variant="filled" insteadbooleantrue-×

Tag.CheckableTag

PropertyDescriptionTypeDefaultVersion
checkedChecked status of Tagbooleanfalse
iconSet the icon of tagReactNode-5.27.0
onChangeCallback executed when Tag is checked/unchecked(checked) => void-

Tag.CheckableTagGroup

PropertyDescriptionTypeDefaultVersion
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props }) => Record<SemanticDOM, string>-
defaultValueInitial valuestring | number | Array<string | number> | null-
disabledDisable check/uncheckboolean-
multipleMultiple select modeboolean-
optionsOption list. Object options support per-item className and style.Array<{ className?: string; label: ReactNode; style?: CSSProperties; value: string | number } | string | number>-className and style: 6.4.0
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props }) => Record<SemanticDOM, CSSProperties>-
valueValue of checked tag(s)string | number | Array<string | number> | null-
onChangeCallback when Tag is checked/unchecked(value: string | number | Array<string | number> | null) => void-

Semantic DOM

Tag

Tag.CheckableTagGroup

Design Token

Component TokenHow to use?
Token NameDescriptionTypeDefault Value
defaultBgDefault background colorstring#f5f5f5
defaultColorDefault text colorstringrgba(0,0,0,0.88)
solidTextColorDefault text color for solid tag.string#fff
Global TokenHow to use?
Token NameDescriptionTypeDefault Value
colorBgContainerDisabledControl the background color of container in disabled state.stringrgba(0,0,0,0.04)
colorBgSolidSolid background color, currently only used for the default solid button background color.stringrgb(0,0,0)
colorBorderDefault border color, used to separate different elements, such as: form separator, card separator, etc.string#d9d9d9
colorBorderDisabledControl the border color of the element in the disabled state.string#d9d9d9
colorFillSecondaryThe second level of fill color can outline the shape of the element more clearly, such as Rate, Skeleton, etc. It can also be used as the Hover state of the third level of fill color, such as Table, etc.stringrgba(0,0,0,0.06)
colorIconWeak action. Such as `allowClear` or Alert close buttonstringrgba(0,0,0,0.45)
colorPrimaryBrand color is one of the most direct visual elements to reflect the characteristics and communication of the product. After you have selected the brand color, we will automatically generate a complete color palette and assign it effective design semantics.string#1677ff
colorPrimaryActiveDark active state under the main color gradient.string#0958d9
colorPrimaryHoverHover state under the main color gradient.string#4096ff
colorTextDefault text color which comply with W3C standards, and this color is also the darkest neutral color.stringrgba(0,0,0,0.88)
colorTextDisabledControl the color of text in disabled state.stringrgba(0,0,0,0.25)
colorTextHeadingControl the font color of heading.stringrgba(0,0,0,0.88)
colorTextLightSolidControl the highlight color of text with background color, such as the text in Primary Button components.string#fff
borderRadiusSMSM size border radius, used in small size components, such as Button, Input, Select and other input components in small sizenumber4
fontFamilyThe font family of Ant Design prioritizes the default interface font of the system, and provides a set of alternative font libraries that are suitable for screen display to maintain the readability and readability of the font under different platforms and browsers, reflecting the friendly, stable and professional characteristics.string-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'
fontSizeThe most widely used font size in the design system, from which the text gradient will be derived.number14
fontSizeIconControl the font size of operation icon in Select, Cascader, etc. Normally same as fontSizeSM.number12
fontSizeSMSmall font sizenumber12
lineHeightLine height of text.number1.5714285714285714
lineHeightSMLine height of small text.number1.6666666666666667
lineTypeBorder style of base componentsstringsolid
lineWidthBorder width of base componentsnumber1
motionDurationMidMotion speed, medium speed. Used for medium element animation interaction.string0.2s
paddingXSControl the extra small padding of the element.number8
paddingXXSControl the extra extra small padding of the element.number4
Basic

Usage of basic Tag, and it could be closable and customize close button by set closeIcon property, will display default close button when closeIcon is setting to true. Closable Tag supports onClose events.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Add & Remove Dynamically

Generating a set of Tags by array, you can add and remove dynamically.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Animate

Animating the Tag by using motion.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Status Tag

We preset five different colors, you can set color property such as success,processing,error,default and warning to indicate specific status.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Custom semantic dom styling

You can customize the semantic dom style of Tag by passing objects/functions through classNames and styles.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
6.0.0
Colorful Tag

We preset a series of colorful tag styles for use in different situations. You can also set it to a hex color string for custom color.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Checkable

CheckableTag works like Checkbox, click it to toggle checked state. CheckableTagGroup provides function that is similar to CheckboxGroup or RadioGroup.

CheckableTag is absolute controlled component and has no uncontrolled mode.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Icon

You can add a custom icon to the tag via the icon prop. Note that the icon prop for CheckableTag is only supported in version >=5.27.0.

If you need to control the icon position, please use the <XXXIcon /> component directly in children instead of the icon prop.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Draggable Tag

Draggable tags using dnd kit.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Tag 1LinkPrevent DefaultTag 2Tag 3
UnremovableTag 2Tag 3New Tag
Tag 1Tag 2Tag 3
New Tag
Status (filled)
successprocessingwarningerrordefault
Status (solid)
successprocessingwarningerrordefault
Status (outlined)
successprocessingwarningerrordefault
ObjectFunction
ReactVueAngular
meet-studentthinkasany
Presets (filled)
magentaredvolcanoorangegoldlimegreencyanbluegeekbluepurple
Presets (solid)
magentaredvolcanoorangegoldlimegreencyanbluegeekbluepurple
Presets (outlined)
magentaredvolcanoorangegoldlimegreencyanbluegeekbluepurple
Custom (filled)
#f50#2db7f5#87d068#108ee9
Custom (solid)
#f50#2db7f5#87d068#108ee9
Custom (outlined)
#f50#2db7f5#87d068#108ee9
Yes
MoviesBooksMusicSports
MoviesBooksMusicSports
Tag with icon
TwitterYoutubeFacebookLinkedIn
CheckableTag with icon
TwitterYoutubeFacebookLinkedIn
Tag 1Tag 2Tag 3
Ant Design
  • root
    6.0.0
    Root element with inline-block display, auto height, padding, font size, line height, nowrap, background color, border, border radius, opacity, transition animations, text alignment, relative positioning and other basic tag styles
  • icon
    6.0.0
    Icon element with font size, color, cursor style, transition animations and other icon display styles
  • content
    6.0.0
    Content element with text content color, font styles and other content area styles
  • close
    6.4.0
    Close element with close button layout, cursor styles, transition animations and other interaction styles
MoviesBooksMusicSports
  • root
    Root element with tag group container styles and layout
  • item
    Tag item element with inline-block display, height, padding, font size, line height, background color, border, border radius, opacity, transition animation, checkable state and other styles