Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 3x 11x 11x 3x | import { forwardRef } from "react";
import Box from "@mui/material/Box";
import { StyledLabel } from "./styles";
const Label = forwardRef(({ children, color = "default", variant = "soft", startIcon, endIcon, sx, ...other }, ref) => {
const iconStyles = {
width: 16,
height: 16,
"& svg, img": { width: 1, height: 1, objectFit: "cover" },
};
return (
<StyledLabel
ref={ref}
component="span"
ownerState={{ color, variant }}
sx={{
...(startIcon && { pl: 0.75 }),
...(endIcon && { pr: 0.75 }),
...sx,
}}
{...other}
>
{startIcon && <Box sx={{ mr: 0.75, ...iconStyles }}> {startIcon} </Box>}
{children}
{endIcon && <Box sx={{ ml: 0.75, ...iconStyles }}> {endIcon} </Box>}
</StyledLabel>
);
});
Label.displayName = "Label";
export default Label;
|