"use client"; import { SelectHTMLAttributes, forwardRef } from "react"; interface SelectOption { value: string; label: string; } interface SelectProps extends SelectHTMLAttributes { label?: string; error?: string; helperText?: string; leftIcon?: string; options: SelectOption[]; placeholder?: string; } const Select = forwardRef( ( { label, error, helperText, leftIcon, options, placeholder, className = "", ...props }, ref ) => { return ( {label && ( {label} {props.required && *} )} {leftIcon && ( )} {placeholder || "Selecione uma opção"} {options.map((option) => ( {option.label} ))} {helperText && !error && ( {helperText} )} {error && {error}} ); } ); Select.displayName = "Select"; export default Select;
{helperText}
{error}