link-stack/packages/ui/components/Select.tsx

32 lines
574 B
TypeScript
Raw Normal View History

2024-04-24 21:44:05 +02:00
import { FC } from "react";
import { Select as InternalSelect } from "@mui/material";
type SelectProps = {
name: string;
label: string;
formState: Record<string, any>;
children: React.ReactNode;
};
export const Select: FC<SelectProps> = ({
name,
label,
formState,
children,
}) => (
<InternalSelect
fullWidth
name={name}
label={label}
variant="outlined"
size="small"
inputProps={{ id: name }}
defaultValue={formState.values[name] || ""}
sx={{
backgroundColor: "#fff",
}}
>
{children}
</InternalSelect>
);