Skip to content

Commit

Permalink
Merge pull request #170 from balena-io-modules/tabs-left-element
Browse files Browse the repository at this point in the history
Tabs: Add `leftElement` prop
  • Loading branch information
myarmolinsky authored Jan 10, 2025
2 parents a048d3a + a78e3e7 commit d66e248
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/Tabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface TabsProps {
currentTab?: string;
onTabChange?: (newTab: number) => void;
setTab?: (newTab: string) => void;
leftElement?: JSX.Element;
}

export const Tabs = ({
Expand All @@ -24,6 +25,7 @@ export const Tabs = ({
onTabChange,
setTab,
currentTab,
leftElement,
}: TabsProps) => {
const [tabState, setTabState] = React.useState(
(defaultTab !== undefined && defaultTab > 0 && defaultTab < tabs.length
Expand Down Expand Up @@ -57,6 +59,7 @@ export const Tabs = ({
]}
{...boxProps}
>
{leftElement}
<TabList onChange={handleChange} variant="scrollable">
{tabs.map(({ label, tabProps }, index) => (
<Tab
Expand Down

0 comments on commit d66e248

Please sign in to comment.