Files
strudel/website/src/repl/panel/SelectInput.jsx
T
2023-12-08 01:01:06 -05:00

19 lines
566 B
React

import React from 'react';
// value: ID, options: Set<{id: ID, label: string}>, onChange: ID => null, onClick: event => void
export function SelectInput({ value, options, onChange, onClick }) {
return (
<select
onClick={onClick}
className="p-2 bg-background rounded-md text-foreground"
value={value}
onChange={(e) => onChange(e.target.value)}
>
{Array.from(options).map(({ id, label }) => (
<option key={id} className="bg-background" value={id}>
{label}
</option>
))}
</select>
);
}