diff --git a/components/card/Card.tsx b/components/card/Card.tsx index fe416d5167..fd0a63ee06 100644 --- a/components/card/Card.tsx +++ b/components/card/Card.tsx @@ -1,4 +1,5 @@ import classNames from 'classnames'; +import type { Tab } from 'rc-tabs/lib/interface'; import omit from 'rc-util/lib/omit'; import * as React from 'react'; import { ConfigContext } from '../config-provider'; @@ -12,10 +13,11 @@ import useStyle from './style'; export type CardType = 'inner'; export type CardSize = 'default' | 'small'; -export interface CardTabListType { +export interface CardTabListType extends Omit { key: string; - tab: React.ReactNode; - disabled?: boolean; + /** @deprecated Please use `label` instead */ + tab?: React.ReactNode; + label?: React.ReactNode; } export interface CardProps extends Omit, 'title'> { @@ -123,10 +125,9 @@ const Card = React.forwardRef((props, ref) => { {...extraProps} className={`${prefixCls}-head-tabs`} onChange={onTabChange} - items={tabList.map((item) => ({ - label: item.tab, - key: item.key, - disabled: item.disabled ?? false, + items={tabList.map(({ tab, ...item }) => ({ + label: tab, + ...item, }))} /> ) : null; diff --git a/components/card/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/card/__tests__/__snapshots__/demo-extend.test.ts.snap index e2846da4c8..34435adb3e 100644 --- a/components/card/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/card/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -771,7 +771,6 @@ Array [ >