2016-08-23 09:37:10 +08:00
|
|
|
---
|
|
|
|
category: Components
|
2022-11-09 12:28:04 +08:00
|
|
|
group: Data Display
|
2016-09-21 11:28:38 +08:00
|
|
|
title: Tag
|
2022-11-30 20:14:41 +08:00
|
|
|
cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*_SBsSrKLg00AAAAAAAAAAAAADrJ8AQ/original
|
2022-11-09 12:28:04 +08:00
|
|
|
demo:
|
|
|
|
cols: 2
|
2016-08-23 09:37:10 +08:00
|
|
|
---
|
|
|
|
|
2017-09-18 10:27:35 +08:00
|
|
|
Tag for categorizing or markup.
|
2016-08-23 09:37:10 +08:00
|
|
|
|
2016-09-10 13:43:30 +08:00
|
|
|
## When To Use
|
2016-08-23 09:37:10 +08:00
|
|
|
|
|
|
|
- It can be used to tag by dimension or property.
|
|
|
|
|
2017-09-18 10:27:35 +08:00
|
|
|
- When categorizing.
|
2016-08-23 09:37:10 +08:00
|
|
|
|
2022-11-09 12:28:04 +08:00
|
|
|
## Examples
|
|
|
|
|
2022-11-17 17:31:26 +08:00
|
|
|
<!-- prettier-ignore -->
|
2022-11-09 12:28:04 +08:00
|
|
|
<code src="./demo/basic.tsx">Basic</code>
|
|
|
|
<code src="./demo/colorful.tsx">Colorful Tag</code>
|
|
|
|
<code src="./demo/colorful-inverse.tsx" debug>Inverse Colorful Tag</code>
|
|
|
|
<code src="./demo/control.tsx">Add & Remove Dynamically</code>
|
|
|
|
<code src="./demo/checkable.tsx">Checkable</code>
|
|
|
|
<code src="./demo/animation.tsx">Animate</code>
|
|
|
|
<code src="./demo/icon.tsx">Icon</code>
|
|
|
|
<code src="./demo/status.tsx">Status Tag</code>
|
|
|
|
<code src="./demo/customize.tsx" debug>Customize close</code>
|
|
|
|
|
2016-08-23 09:37:10 +08:00
|
|
|
## API
|
|
|
|
|
2016-11-10 11:14:03 +08:00
|
|
|
### Tag
|
|
|
|
|
2022-08-15 14:39:02 +08:00
|
|
|
| Property | Description | Type | Default | Version |
|
|
|
|
| --------- | ------------------------------------ | ----------- | ------- | ------- |
|
|
|
|
| closable | Whether the Tag can be closed | boolean | false | |
|
|
|
|
| closeIcon | Custom close icon | ReactNode | - | 4.4.0 |
|
|
|
|
| color | Color of the Tag | string | - | |
|
|
|
|
| icon | Set the icon of tag | ReactNode | - | |
|
|
|
|
| onClose | Callback executed when tag is closed | (e) => void | - | |
|
2016-11-10 11:14:03 +08:00
|
|
|
|
|
|
|
### Tag.CheckableTag
|
|
|
|
|
2022-08-15 14:39:02 +08:00
|
|
|
| Property | Description | Type | Default |
|
|
|
|
| -------- | ----------------------------------------------- | ----------------- | ------- |
|
|
|
|
| checked | Checked status of Tag | boolean | false |
|
|
|
|
| onChange | Callback executed when Tag is checked/unchecked | (checked) => void | - |
|