2026-01-23 12:33:40 -08:00
|
|
|
import Typography from "@mui/material/Typography";
|
|
|
|
|
import { useTheme } from "@mui/material/styles";
|
|
|
|
|
|
|
|
|
|
interface FieldLabelProps {
|
|
|
|
|
children: React.ReactNode;
|
|
|
|
|
required?: boolean;
|
|
|
|
|
htmlFor?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const FieldLabel = ({ children, required = false, htmlFor }: FieldLabelProps) => {
|
|
|
|
|
const theme = useTheme();
|
2026-02-05 18:49:47 +00:00
|
|
|
if (children === " ") {
|
|
|
|
|
children = "\u00A0";
|
|
|
|
|
}
|
2026-01-23 12:33:40 -08:00
|
|
|
return (
|
|
|
|
|
<Typography
|
|
|
|
|
component="label"
|
2026-04-28 23:54:39 -04:00
|
|
|
variant="body1"
|
2026-01-23 12:33:40 -08:00
|
|
|
htmlFor={htmlFor}
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: theme.palette.text.secondary,
|
|
|
|
|
marginBottom: theme.spacing(2),
|
|
|
|
|
display: "block",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
{required && (
|
|
|
|
|
<span
|
|
|
|
|
style={{
|
|
|
|
|
color: theme.palette.error.main,
|
|
|
|
|
marginLeft: theme.spacing(2),
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
*
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
</Typography>
|
|
|
|
|
);
|
|
|
|
|
};
|