Skip to content

Commit

Permalink
chore: add className modifiers for TabManu root and contents elements
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiehenson committed Dec 17, 2024
1 parent e921d4b commit e5ba60a
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/core/TabMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ export type TabMenuProps = {
*/
tabClassName?: string;

/**
* An optional class name to apply to the Tabs.Root element.
*/
rootClassName?: string;

/**
* An optional class name to apply to the Tabs.Content element.
*/
contentClassName?: string;

/**
* Optional configuration options for the TabMenu.
*/
Expand Down Expand Up @@ -65,6 +75,8 @@ const TabMenu: React.FC<TabMenuProps> = ({
contents = [],
tabOnClick,
tabClassName,
rootClassName,
contentClassName,
options,
}) => {
const {
Expand Down Expand Up @@ -129,7 +141,7 @@ const TabMenu: React.FC<TabMenuProps> = ({
return (
<Tabs.Root
defaultValue={`tab-${defaultTabIndex}`}
className={cn({ "h-full": flexibleTabHeight })}
className={cn({ "h-full": flexibleTabHeight }, rootClassName)}
>
<Tabs.List
ref={listRef}
Expand Down Expand Up @@ -170,7 +182,11 @@ const TabMenu: React.FC<TabMenuProps> = ({
></div>
</Tabs.List>
{contents.map((content, index) => (
<Tabs.Content key={`tab-${index}`} value={`tab-${index}`}>
<Tabs.Content
key={`tab-${index}`}
value={`tab-${index}`}
className={contentClassName}
>
{content}
</Tabs.Content>
))}
Expand Down

0 comments on commit e5ba60a

Please sign in to comment.