diff --git a/packages/blade/src/components/Tabs/types.ts b/packages/blade/src/components/Tabs/types.ts index 0dcf31037d6..46a75d6397c 100644 --- a/packages/blade/src/components/Tabs/types.ts +++ b/packages/blade/src/components/Tabs/types.ts @@ -55,20 +55,11 @@ type TabsProps = { isLazy?: boolean; } & DataAnalyticsAttribute; -type TabItemProps = { - /** - * The label of the tab item. - */ - children?: React.ReactNode; +type TabItemCommonProps = { /** * The value of the tab item. */ value: string; - /** - * Leading element of the tab item. - * Can be used to render an Icon. - */ - leading?: IconComponent; /** * Trailing element of the tab item. * Can be used to render a Badge/Counter component. @@ -94,6 +85,32 @@ type TabItemProps = { onClick?: (event: React.MouseEvent) => void; }; +type TabItemWithoutLeadingProps = TabItemCommonProps & { + /** + * The content of the tab item. + */ + children: React.ReactNode; + /** + * Leading element of the tab item. + * Can be used to render an Icon. + */ + leading?: undefined; +}; + +type TabItemWithOutChildrenProps = TabItemCommonProps & { + /** + * Leading element of the tab item. + * Can be used to render an Icon. + */ + leading: IconComponent; + /** + * The content of the tab item. + */ + children?: React.ReactNode; +}; + +type TabItemProps = TabItemWithoutLeadingProps | TabItemWithOutChildrenProps; + type TabPanelProps = { /** * The value of the tab panel. This will be used to match the selected tab.