Files
frontend/apps/dc/src/shared/ui/code-select.tsx
T
2025-10-17 11:52:42 +09:00

41 lines
961 B
TypeScript

import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@common/components";
type CodeSelectProps = {
value?: string;
onValueChange?: (value: string) => void;
options: { value: string; label: string }[];
placeholder?: string;
className?: string;
disabled?: boolean;
};
export function CodeSelect({
value,
onValueChange,
options,
placeholder = "선택",
className,
disabled = false,
}: CodeSelectProps) {
return (
<Select value={value ?? ""} onValueChange={onValueChange} disabled={disabled}>
<SelectTrigger className={className}>
<SelectValue placeholder={placeholder} />
</SelectTrigger>
<SelectContent>
<SelectItem value="__SELECT__">선택</SelectItem>
{options.map((option) => (
<SelectItem key={option.value} value={option.value}>
{option.label}
</SelectItem>
))}
</SelectContent>
</Select>
);
}