diff --git a/docs/examples/basic.tsx b/docs/examples/basic.tsx index 5864bc88..f38970ee 100644 --- a/docs/examples/basic.tsx +++ b/docs/examples/basic.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import Tabs from'../../src'; import '../../assets/index.less'; +import Tabs from '../../src'; export default () => { const [destroy, setDestroy] = React.useState(false); @@ -9,17 +9,20 @@ export default () => { label: 'Light', key: 'light', children: 'Light!', + icon: 🌞, }, { label: 'Bamboo', key: 'bamboo', children: 'Bamboo!', + icon: 🎋, }, { label: 'Cute', key: 'cute', children: 'Cute!', disabled: true, + icon: 🐼, }, ]); @@ -38,6 +41,7 @@ export default () => { key: 'yo', label: 'Yo', children: 'Yo!', + icon: 👋, }, ]); }} diff --git a/src/TabNavList/TabNode.tsx b/src/TabNavList/TabNode.tsx index a76d57ac..460f1e3f 100644 --- a/src/TabNavList/TabNode.tsx +++ b/src/TabNavList/TabNode.tsx @@ -24,7 +24,7 @@ function TabNode({ prefixCls, id, active, - tab: { key, label, disabled, closeIcon }, + tab: { key, label, disabled, closeIcon, icon }, closable, renderWrapper, removeAriaLabel, @@ -87,6 +87,7 @@ function TabNode({ }} onFocus={onFocus} > + {icon} {label} diff --git a/src/TabPanelList/TabPane.tsx b/src/TabPanelList/TabPane.tsx index e153623d..fdb4ba60 100644 --- a/src/TabPanelList/TabPane.tsx +++ b/src/TabPanelList/TabPane.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; import classNames from 'classnames'; +import * as React from 'react'; export interface TabPaneProps { tab?: React.ReactNode; @@ -10,6 +10,7 @@ export interface TabPaneProps { forceRender?: boolean; closable?: boolean; closeIcon?: React.ReactNode; + icon?: React.ReactNode; // Pass by TabPaneList prefixCls?: string; diff --git a/tsconfig.json b/tsconfig.json index f279d1b9..aeeacaa4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,5 +23,9 @@ ] } }, - "include": [".dumi/**/*", ".dumirc.ts", "**/*.ts", "**/*.tsx"] -} + "include": [ + ".dumirc.ts", + "**/*.ts", + "**/*.tsx" + ] +} \ No newline at end of file