import classNames from "classnames"; import { Listbox, ListboxButton, ListboxOption, ListboxOptions } from "@headlessui/react"; import { IconChevronDown } from "@tabler/icons-react"; export interface SelectOption { value: T; label: string; disabled?: boolean; } export interface SelectProps { name: string; label: string; value: T; onChange: (value: T) => void; options: SelectOption[]; helpText?: string; placeholder?: string; className?: string; labelClassName?: string; selectClassName?: string; containerClassName?: string; error?: boolean; required?: boolean; disabled?: boolean; } const Select = ({ name, label, value, onChange, options, helpText, placeholder, className, labelClassName, selectClassName, containerClassName, error, required, disabled, }: SelectProps) => { const selectedOption = options.find((o) => o.value === value); return (
{helpText &&

{helpText}

}
{selectedOption ? selectedOption.label : (placeholder ?? label)} {options.map((option, index) => ( {option.label} ))}
); }; export default Select;