We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dded331 commit 7574845Copy full SHA for 7574845
src/components/tabs/index.tsx
@@ -14,12 +14,13 @@ export interface ITab<T = any, K = any> {
14
15
interface ITabsProps {
16
data: ITab[];
17
+ onClose?: (item: ITab, index: number) => void;
18
}
19
20
const Tabs: React.FunctionComponent<ITabsProps> = (props: ITabsProps) => {
- const { data } = props;
21
- const tabs = data.map((tab: ITab) => {
22
- return (<a key={tab.id}>{tab.name}</a>);
+ const { data, onClose } = props;
+ const tabs = data.map((tab: ITab, index: number) => {
23
+ return (<a key={tab.id}>{tab.name} <button onClick={(e) => onClose!(tab, index)}>Close</button></a>);
24
});
25
return (
26
<div className={prefixClaName('tabs')}>
0 commit comments