Add back ref for Selects

This commit is contained in:
Justin Edmund 2022-12-23 21:19:23 -08:00
parent abf862e323
commit 604d00da90

View file

@ -20,7 +20,10 @@ interface Props
triggerClass?: string
}
const Select = (props: Props) => {
const Select = React.forwardRef<HTMLButtonElement, Props>(function input(
props: Props,
forwardedRef
) {
const [value, setValue] = useState('')
useEffect(() => {
@ -41,6 +44,7 @@ const Select = (props: Props) => {
<RadixSelect.Trigger
className={classNames('SelectTrigger', props.triggerClass)}
placeholder={props.placeholder}
ref={forwardedRef}
>
<RadixSelect.Value placeholder={props.placeholder} />
<RadixSelect.Icon className="SelectIcon">
@ -61,6 +65,6 @@ const Select = (props: Props) => {
</RadixSelect.Portal>
</RadixSelect.Root>
)
}
})
export default Select