Files
Checkmate/client/src/Components/Tab/index.jsx
T

40 lines
984 B
React
Raw Normal View History

2025-04-10 14:48:10 -04:00
import { Box, useTheme } from "@mui/material";
import { TabList } from "@mui/lab";
import PropTypes from "prop-types";
2025-04-10 17:51:14 -04:00
/**
* CustomTabList component
* @param {string} value - The currently selected tab's value.
* @param {function} onChange - Callback when a different tab is selected.
* @param {React.ReactNode} children - Tab components to render inside the TabList.
* @param {object} props - Additional props passed to the TabList component.
*/
2025-04-10 17:41:54 -04:00
const CustomTabList = ({ value, onChange, children, ...props }) => {
2025-04-10 14:48:10 -04:00
const theme = useTheme();
return (
<Box
sx={{
borderBottom: `1px solid ${theme.palette.primary.lowContrast}`,
"& .MuiTabs-root": { height: "fit-content", minHeight: "0" },
}}
>
2025-05-27 09:10:32 -07:00
<TabList
value={value}
onChange={onChange}
{...props}
>
2025-04-10 14:48:10 -04:00
{children}
</TabList>
</Box>
);
};
2025-04-10 17:41:54 -04:00
CustomTabList.propTypes = {
2025-04-10 14:48:10 -04:00
value: PropTypes.string,
onChange: PropTypes.func,
children: PropTypes.node,
};
2025-04-10 17:41:54 -04:00
export default CustomTabList;