diff --git a/packages/react-core/src/demos/Tabs.md b/packages/react-core/src/demos/Tabs.md index a67309a67dc..1709c39e379 100644 --- a/packages/react-core/src/demos/Tabs.md +++ b/packages/react-core/src/demos/Tabs.md @@ -437,3 +437,7 @@ TabsOpenWithSecondaryTabsDemo = () => { ); }; ``` + +### Nested tabs +```js isFullscreen file="./Tabs/NestedTabsDemo.js" +``` \ No newline at end of file diff --git a/packages/react-core/src/demos/Tabs/NestedTabsDemo.js b/packages/react-core/src/demos/Tabs/NestedTabsDemo.js new file mode 100644 index 00000000000..66d3bbc482d --- /dev/null +++ b/packages/react-core/src/demos/Tabs/NestedTabsDemo.js @@ -0,0 +1,151 @@ +import React from 'react'; +import { + Card, + CardHeader, + CardBody, + Grid, + GridItem, + PageSection, + PageSectionVariants, + Tabs, + Tab, + TabContent, + TabContentBody, + TabTitleText, + Title, + Flex, + FlexItem +} from '@patternfly/react-core'; +import DashboardWrapper from '../examples/DashboardWrapper'; + +export const NestedTabsDemo = () => { + const [activeTabKey, setActiveTabKey] = React.useState(0); + const [activeNestedTabKey, setActiveNestedTabKey] = React.useState(10); + + // Toggle currently active tab + const handleTabClick = (_, tabIndex) => setActiveTabKey(tabIndex); + + // Toggle currently active nested tab + const handleNestedTabClick = (_, tabIndex) => setActiveNestedTabKey(tabIndex); + + const tabContent = ( + + + + + Status + + + + + + Cluster} tabContentId={`tabContent${10}`} /> + Control plane} + tabContentId={`tabContent${11}`} + /> + Operators} tabContentId={`tabContent${12}`} /> + Virtualization} + tabContentId={`tabContent${13}`} + /> + + + + + + + + + + + + + + + + + + Title of Card + + + + + + + Title of Card + + + + + + + ); + + return ( + + + + Overview + + + + + Cluster 1} tabContentId={`tabContent${0}`} /> + Cluster 2} tabContentId={`tabContent${1}`} /> + + + + + + + + ); +};