import React, { useState } from 'react';
import { States } from '../../utilities';
import { Text } from '../Text';
import { Tabs, TabsProps } from './Tabs';
export default { title: 'Components/Tabs' };
const TAB_LIST = [
{
name: 'tab1',
title: 'Tab 1',
panel: (
FIRST PANEL:
Tabs accepts two parameters:
- tabs: And array of tab items
- onTabClicked: Optional callback when a tab is clicked. Returns the name of the tab
that was clicked.
{""}
)
},
{
name: 'tab2',
title: 'Tab 2',
panel: Second panel
}
];
export const Basic = () => (
>
);
export const WithCallback = () => {
const [tabName, setTabName] = useState('Tabname will be updated on click');
const handleTabClick = (tabName: string) => {
setTabName(tabName);
};
return (
>
<>
Selected Tab:
{tabName}
>
);
};