mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-18 05:03:31 -05:00
33 lines
617 B
TypeScript
33 lines
617 B
TypeScript
import { Select, SelectProps } from "@chakra-ui/react";
|
|
|
|
interface Props {
|
|
value: string;
|
|
setValue: (value?: string) => void;
|
|
placeholder?: string;
|
|
name?: string;
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
const ChakraSelect: React.FC<Props & SelectProps> = ({
|
|
value,
|
|
setValue,
|
|
placeholder,
|
|
children,
|
|
name,
|
|
...props
|
|
}) => (
|
|
<Select
|
|
value={value ?? ""}
|
|
onChange={(e) =>
|
|
setValue(e.target.value === "" ? undefined : e.target.value)
|
|
}
|
|
name={name}
|
|
{...props}
|
|
>
|
|
{placeholder && <option value="">{placeholder}</option>}
|
|
{children}
|
|
</Select>
|
|
);
|
|
|
|
export default ChakraSelect;
|