Credentials UI (#1828)

This commit is contained in:
Shuchang Zheng
2025-02-24 11:54:18 -08:00
committed by GitHub
parent 39ab9c0603
commit c5a2438e7f
13 changed files with 337 additions and 27 deletions

View File

@@ -0,0 +1,50 @@
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "./ui/select";
type Item = {
label: string;
value: string;
};
type Props = {
options: Item[];
value: string;
onChange: (selected: string) => void;
placeholder?: string;
className?: string;
};
function DropdownWithOptions({
options,
value,
onChange,
placeholder,
className,
}: Props) {
return (
<Select
value={value}
onValueChange={(value) => {
onChange(value);
}}
>
<SelectTrigger className={className}>
<SelectValue placeholder={placeholder} />
</SelectTrigger>
<SelectContent className="max-h-48">
{options.map((option) => (
<SelectItem key={option.value} value={option.value}>
{option.label}
</SelectItem>
))}
</SelectContent>
</Select>
);
}
export { DropdownWithOptions };