feat: add simple select component

This commit is contained in:
Aleix Soler 2025-07-19 13:36:20 +02:00
parent 1cfa85db8f
commit b412698403

View file

@ -0,0 +1,26 @@
import React, { ReactNode } from "react";
type SelectProps = {
options: { value: string | number; display: ReactNode }[];
onChange: (value: string) => void;
defaultValue?: string;
};
export const Select: React.FC<SelectProps> = ({
options,
onChange,
defaultValue,
}) => {
return (
<select
defaultValue={defaultValue}
onChange={(e) => onChange(e.target.value)}
>
{options.map((option) => (
<option key={option.value} value={option.value}>
{option.display}
</option>
))}
</select>
);
};