-
- cyan
-
+ cyan
-
- gold
-
+ gold
-
- cyan
-
+ cyan
gold },
- { value: 'lime', label: lime },
- { value: 'green', label: green },
- { value: 'cyan', label: cyan },
-];
+const options = [{ value: 'gold' }, { value: 'lime' }, { value: 'green' }, { value: 'cyan' }];
const tagRender: TagRender = (props) => {
const { label, value, closable, onClose } = props;
@@ -23,7 +18,7 @@ const tagRender: TagRender = (props) => {
onMouseDown={onPreventMouseDown}
closable={closable}
onClose={onClose}
- style={{ marginInlineEnd: 4 }}
+ style={{ marginRight: 3 }}
>
{label}
diff --git a/components/table/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/table/__tests__/__snapshots__/demo-extend.test.ts.snap
index 70411d8639..376e356b05 100644
--- a/components/table/__tests__/__snapshots__/demo-extend.test.ts.snap
+++ b/components/table/__tests__/__snapshots__/demo-extend.test.ts.snap
@@ -86,20 +86,16 @@ exports[`renders components/table/demo/basic.tsx extend context correctly 1`] =
-
-
- NICE
-
-
- DEVELOPER
-
-
+ NICE
+
+
+ DEVELOPER
+
|
-
-
- LOSER
-
-
+ LOSER
+
|
-
-
- COOL
-
-
- TEACHER
-
-
+ COOL
+
+
+ TEACHER
+
|
-
-
- NICE
-
-
- DEVELOPER
-
-
+ nice
+
+
+ developer
+
|
-
-
- LOSER
-
-
+ loser
+
|
-
-
- COOL
-
-
- TEACHER
-
-
+ cool
+
+
+ teacher
+
|
-
+
@@ -22972,7 +22946,7 @@ exports[`renders components/table/demo/pagination.tsx extend context correctly 1
>
DEVELOPER
-
+
|
-
+
LOSER
-
+
|
-
+
@@ -23091,7 +23061,7 @@ exports[`renders components/table/demo/pagination.tsx extend context correctly 1
>
TEACHER
-
+
|
-
-
- NICE
-
-
- DEVELOPER
-
-
+ NICE
+
+
+ DEVELOPER
+
|
-
-
- LOSER
-
-
+ LOSER
+
|
-
-
- COOL
-
-
- TEACHER
-
-
+ COOL
+
+
+ TEACHER
+
|
-
-
- NICE
-
-
- DEVELOPER
-
-
+ nice
+
+
+ developer
+
|
-
-
- LOSER
-
-
+ loser
+
|
-
-
- COOL
-
-
- TEACHER
-
-
+ cool
+
+
+ teacher
+
|
-
+
@@ -18392,7 +18366,7 @@ exports[`renders components/table/demo/pagination.tsx correctly 1`] = `
>
DEVELOPER
-
+
|
-
+
LOSER
-
+
|
-
+
@@ -18515,7 +18485,7 @@ exports[`renders components/table/demo/pagination.tsx correctly 1`] = `
>
TEACHER
-
+
|
['columns'] = [
key: 'tags',
dataIndex: 'tags',
render: (_, { tags }) => (
-
- {tags.map((tag) => {
+ <>
+ {tags.map((tag) => {
let color = tag.length > 5 ? 'geekblue' : 'green';
if (tag === 'loser') {
color = 'volcano';
@@ -44,7 +44,7 @@ const columns: TableProps['columns'] = [
);
})}
-
+ >
),
},
{
diff --git a/components/table/demo/jsx.tsx b/components/table/demo/jsx.tsx
index f8d54ca8b2..4dadb6720d 100644
--- a/components/table/demo/jsx.tsx
+++ b/components/table/demo/jsx.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { Flex, Space, Table, Tag } from 'antd';
+import { Space, Table, Tag } from 'antd';
const { Column, ColumnGroup } = Table;
@@ -52,19 +52,13 @@ const App: React.FC = () => (
dataIndex="tags"
key="tags"
render={(tags: string[]) => (
-
- {tags.map((tag) => {
- let color = tag.length > 5 ? 'geekblue' : 'green';
- if (tag === 'loser') {
- color = 'volcano';
- }
- return (
-
- {tag.toUpperCase()}
-
- );
- })}
-
+ <>
+ {tags.map((tag) => (
+
+ {tag}
+
+ ))}
+ >
)}
/>
= TableProps['columns'];
@@ -50,8 +50,8 @@ const columns: ColumnsType = [
key: 'tags',
dataIndex: 'tags',
render: (tags: string[]) => (
-
- {tags.map((tag) => {
+
+ {tags.map((tag) => {
let color = tag.length > 5 ? 'geekblue' : 'green';
if (tag === 'loser') {
color = 'volcano';
@@ -62,7 +62,7 @@ const columns: ColumnsType = [
);
})}
-
+
),
},
{
diff --git a/components/tag/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/tag/__tests__/__snapshots__/demo-extend.test.ts.snap
index d276fb67c8..218e517ec9 100644
--- a/components/tag/__tests__/__snapshots__/demo-extend.test.ts.snap
+++ b/components/tag/__tests__/__snapshots__/demo-extend.test.ts.snap
@@ -6,100 +6,96 @@ Array [
style="margin-bottom: 16px;"
>
-
+ Tag 1
- Tag 1
-
-
-
+
+
+
+
+ Tag 2
- Tag 2
-
-
-
+
+
+
+
+ Tag 3
- Tag 3
-
-
-
+
+
-
+
,
+Array [
Tag 1
-
+ ,
@@ -152,7 +146,7 @@ exports[`renders components/tag/demo/basic.tsx extend context correctly 1`] = `
>
Link
-
+ ,
@@ -178,7 +172,7 @@ exports[`renders components/tag/demo/basic.tsx extend context correctly 1`] = `
/>
-
+ ,
@@ -207,8 +201,8 @@ exports[`renders components/tag/demo/basic.tsx extend context correctly 1`] = `
-
-
+ ,
+]
`;
exports[`renders components/tag/demo/basic.tsx extend context correctly 2`] = `[]`;
@@ -216,7 +210,8 @@ exports[`renders components/tag/demo/basic.tsx extend context correctly 2`] = `[
exports[`renders components/tag/demo/borderless.tsx extend context correctly 1`] = `
Array [
,
Categories:
@@ -552,7 +551,8 @@ Array [
,
,
,
,
-
+ Tag 1
- Tag 1
-
-
-
+
+
+
+
+ Tag 2
- Tag 2
-
-
-
+
+
+
+
+ Tag 3
- Tag 3
-
-
-
+
+
-
+
,
+Array [
Tag 1
-
+ ,
@@ -150,7 +144,7 @@ exports[`renders components/tag/demo/basic.tsx correctly 1`] = `
>
Link
-
+ ,
@@ -176,7 +170,7 @@ exports[`renders components/tag/demo/basic.tsx correctly 1`] = `
/>
-
+ ,
@@ -205,14 +199,15 @@ exports[`renders components/tag/demo/basic.tsx correctly 1`] = `
-
-
+ ,
+]
`;
exports[`renders components/tag/demo/borderless.tsx correctly 1`] = `
Array [
,
Categories:
@@ -542,7 +541,8 @@ Array [
,
,
,
,
{
@@ -73,9 +73,7 @@ const App: React.FC = () => {
}
}}
>
-
- {tagChild}
-
+ {tagChild}
{inputVisible ? (
diff --git a/components/tag/demo/basic.tsx b/components/tag/demo/basic.tsx
index 5476737640..21134b87d6 100644
--- a/components/tag/demo/basic.tsx
+++ b/components/tag/demo/basic.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import { CloseCircleOutlined } from '@ant-design/icons';
-import { Flex, Tag } from 'antd';
+import { Tag } from 'antd';
const preventDefault = (e: React.MouseEvent ) => {
e.preventDefault();
@@ -8,7 +8,7 @@ const preventDefault = (e: React.MouseEvent) => {
};
const App: React.FC = () => (
-
+ <>
Tag 1
Link
@@ -19,7 +19,7 @@ const App: React.FC = () => (
} onClose={console.log}>
Tag 2
-
+ >
);
export default App;
diff --git a/components/tag/demo/borderless.tsx b/components/tag/demo/borderless.tsx
index 26ccb9ae98..da95014d87 100644
--- a/components/tag/demo/borderless.tsx
+++ b/components/tag/demo/borderless.tsx
@@ -3,7 +3,7 @@ import { Divider, Flex, Tag } from 'antd';
const App: React.FC = () => (
<>
-
+
Tag 1
Tag 2
@@ -14,7 +14,7 @@ const App: React.FC = () => (
-
+
processing
diff --git a/components/tag/demo/borderlessLayout.tsx b/components/tag/demo/borderlessLayout.tsx
index 8ad6fc8618..a3c614732d 100644
--- a/components/tag/demo/borderlessLayout.tsx
+++ b/components/tag/demo/borderlessLayout.tsx
@@ -5,7 +5,7 @@ const App: React.FC = () => {
const { token } = theme.useToken();
return (
-
+
Tag 1
Tag 2
@@ -16,7 +16,7 @@ const App: React.FC = () => {
-
+
magenta
diff --git a/components/tag/demo/checkable.tsx b/components/tag/demo/checkable.tsx
index 412052603f..65cea1425d 100644
--- a/components/tag/demo/checkable.tsx
+++ b/components/tag/demo/checkable.tsx
@@ -14,7 +14,7 @@ const App: React.FC = () => {
};
return (
-
+
Categories:
{tagsData.map((tag) => (
(
-
+
magenta
red
volcano
diff --git a/components/tag/demo/colorful.tsx b/components/tag/demo/colorful.tsx
index 0ab8125033..e0e4e4765f 100644
--- a/components/tag/demo/colorful.tsx
+++ b/components/tag/demo/colorful.tsx
@@ -4,7 +4,7 @@ import { Divider, Flex, Tag } from 'antd';
const App: React.FC = () => (
<>
Presets
-
+
magenta
red
volcano
@@ -18,7 +18,7 @@ const App: React.FC = () => (
purple
Custom
-
+
#f50
#2db7f5
#87d068
diff --git a/components/tag/demo/component-token.tsx b/components/tag/demo/component-token.tsx
index fa918c49cb..f47a7fa493 100644
--- a/components/tag/demo/component-token.tsx
+++ b/components/tag/demo/component-token.tsx
@@ -6,7 +6,7 @@ const App: React.FC = () => (
-
+
Link
diff --git a/components/tag/demo/control.tsx b/components/tag/demo/control.tsx
index fcb775981b..bf25ca662b 100644
--- a/components/tag/demo/control.tsx
+++ b/components/tag/demo/control.tsx
@@ -71,7 +71,7 @@ const App: React.FC = () => {
};
return (
-
+
{tags.map((tag, index) => {
if (editInputIndex === index) {
return (
diff --git a/components/tag/demo/customize.tsx b/components/tag/demo/customize.tsx
index d52605cb79..007608b36c 100644
--- a/components/tag/demo/customize.tsx
+++ b/components/tag/demo/customize.tsx
@@ -3,7 +3,7 @@ import { CloseCircleOutlined } from '@ant-design/icons';
import { Flex, Tag } from 'antd';
const App: React.FC = () => (
-
+
Tag1
diff --git a/components/tag/demo/draggable.tsx b/components/tag/demo/draggable.tsx
index 6b0dcca70b..ad4b7e792e 100644
--- a/components/tag/demo/draggable.tsx
+++ b/components/tag/demo/draggable.tsx
@@ -68,7 +68,7 @@ const App: React.FC = () => {
return (
-
+
{items.map((item) => (
))}
diff --git a/components/tag/demo/icon.tsx b/components/tag/demo/icon.tsx
index 5749eb0f7f..04fbbe9563 100644
--- a/components/tag/demo/icon.tsx
+++ b/components/tag/demo/icon.tsx
@@ -8,7 +8,7 @@ import {
import { Flex, Tag } from 'antd';
const App: React.FC = () => (
-
+
} color="#55acee">
Twitter
diff --git a/components/tag/demo/status.tsx b/components/tag/demo/status.tsx
index 91d55f375b..af768a92c5 100644
--- a/components/tag/demo/status.tsx
+++ b/components/tag/demo/status.tsx
@@ -12,7 +12,7 @@ import { Divider, Flex, Tag } from 'antd';
const App: React.FC = () => (
<>
Without icon
-
+
success
processing
error
@@ -20,7 +20,7 @@ const App: React.FC = () => (
default
With icon
-
+
} color="success">
success
diff --git a/components/tag/style/index.ts b/components/tag/style/index.ts
index 365b095849..4165b0abe9 100644
--- a/components/tag/style/index.ts
+++ b/components/tag/style/index.ts
@@ -40,6 +40,8 @@ const genBaseStyle = (token: TagToken): CSSInterpolation => {
...resetComponent(token),
display: 'inline-block',
height: 'auto',
+ // https://github.com/ant-design/ant-design/pull/47504
+ marginInlineEnd: token.marginXS,
paddingInline,
fontSize: token.tagFontSize,
lineHeight: token.tagLineHeight,
|