Skip to content

Commit 19ad7ec

Browse files
committed
update Tabs component - add MuiBox
1 parent 4aed331 commit 19ad7ec

File tree

1 file changed

+23
-19
lines changed
  • chartlets.js/packages/lib/src/plugins/mui

1 file changed

+23
-19
lines changed

chartlets.js/packages/lib/src/plugins/mui/Tabs.tsx

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import MuiBox from "@mui/material/Box";
12
import MuiIcon from "@mui/material/Icon";
23
import MuiTabs from "@mui/material/Tabs";
34
import MuiTab from "@mui/material/Tab";
@@ -43,24 +44,27 @@ export function Tabs({
4344
}
4445
};
4546
return (
46-
<div>
47-
<MuiTabs id={id} style={style} value={value} onChange={handleChange}>
48-
{tabItems?.map((tab, index) => {
49-
const tabState = isComponentState(tab)
50-
? (tab as TabState)
51-
: undefined;
52-
return (
53-
<MuiTab
54-
key={index}
55-
label={tabState ? tabState.label : isString(tab) ? tab : ""}
56-
icon={
57-
tabState && tabState.icon && <MuiIcon>{tabState.icon}</MuiIcon>
58-
}
59-
disabled={disabled || (tabState && tabState.disabled)}
60-
/>
61-
);
62-
})}
63-
</MuiTabs>
47+
<MuiBox sx={{ width: "100%" }}>
48+
<MuiBox sx={{ borderBottom: 1, borderColor: "divider" }}>
49+
<MuiTabs id={id} style={style} value={value} onChange={handleChange}>
50+
{tabItems?.map((tab, index) => {
51+
const tabState = isComponentState(tab)
52+
? (tab as TabState)
53+
: undefined;
54+
return (
55+
<MuiTab
56+
key={index}
57+
label={tabState ? tabState.label : isString(tab) ? tab : ""}
58+
icon={
59+
tabState &&
60+
tabState.icon && <MuiIcon>{tabState.icon}</MuiIcon>
61+
}
62+
disabled={disabled || (tabState && tabState.disabled)}
63+
/>
64+
);
65+
})}
66+
</MuiTabs>
67+
</MuiBox>
6468
{tabItems?.map((tab, index) => {
6569
const tabState = isComponentState(tab) ? (tab as TabState) : undefined;
6670
return (
@@ -74,6 +78,6 @@ export function Tabs({
7478
)
7579
);
7680
})}
77-
</div>
81+
</MuiBox>
7882
);
7983
}

0 commit comments

Comments
 (0)