Files
Checkmate/client/src/components/inputs/FormField.tsx
T
2025-11-13 13:47:26 -08:00

31 lines
610 B
TypeScript

import Stack from "@mui/material/Stack";
import { FieldLabel } from "./FieldLabel";
import { useTheme } from "@mui/material/styles";
interface FormFieldProps {
label?: string;
required?: boolean;
children: React.ReactNode;
htmlFor?: string;
}
export const FormField: React.FC<FormFieldProps> = ({
label,
required = false,
children,
htmlFor,
}) => {
const theme = useTheme();
return (
<Stack spacing={theme.spacing(2)}>
{label && (
<FieldLabel required={required} htmlFor={htmlFor}>
{label}
</FieldLabel>
)}
{children}
</Stack>
);
};