diff --git a/lib/components/Tabs/Tabs.tsx b/lib/components/Tabs/Tabs.tsx index 34d1c7fc..ad1ce0c8 100644 --- a/lib/components/Tabs/Tabs.tsx +++ b/lib/components/Tabs/Tabs.tsx @@ -1,4 +1,4 @@ -import React, { ReactElement, useState } from 'react'; +import React, { ReactElement, useEffect, useState } from 'react'; import TabTitle, { TabTitleProps } from './TabTitle'; import clsx from 'clsx'; import './Tabs.scss'; @@ -15,6 +15,12 @@ type TabsProps = { const Tabs = ({ children, activeTab, wrapperClassName, className, variant = 'primary', onChange }: TabsProps): JSX.Element => { const [selectedTab, setSelectedTab] = useState(activeTab || children[0].props.title); + useEffect(() => { + if (activeTab) { + setSelectedTab(activeTab); + } + }, [activeTab]); + return (