Add back ref for Selects
This commit is contained in:
parent
abf862e323
commit
604d00da90
1 changed files with 6 additions and 2 deletions
|
|
@ -20,7 +20,10 @@ interface Props
|
||||||
triggerClass?: string
|
triggerClass?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const Select = (props: Props) => {
|
const Select = React.forwardRef<HTMLButtonElement, Props>(function input(
|
||||||
|
props: Props,
|
||||||
|
forwardedRef
|
||||||
|
) {
|
||||||
const [value, setValue] = useState('')
|
const [value, setValue] = useState('')
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -41,6 +44,7 @@ const Select = (props: Props) => {
|
||||||
<RadixSelect.Trigger
|
<RadixSelect.Trigger
|
||||||
className={classNames('SelectTrigger', props.triggerClass)}
|
className={classNames('SelectTrigger', props.triggerClass)}
|
||||||
placeholder={props.placeholder}
|
placeholder={props.placeholder}
|
||||||
|
ref={forwardedRef}
|
||||||
>
|
>
|
||||||
<RadixSelect.Value placeholder={props.placeholder} />
|
<RadixSelect.Value placeholder={props.placeholder} />
|
||||||
<RadixSelect.Icon className="SelectIcon">
|
<RadixSelect.Icon className="SelectIcon">
|
||||||
|
|
@ -61,6 +65,6 @@ const Select = (props: Props) => {
|
||||||
</RadixSelect.Portal>
|
</RadixSelect.Portal>
|
||||||
</RadixSelect.Root>
|
</RadixSelect.Root>
|
||||||
)
|
)
|
||||||
}
|
})
|
||||||
|
|
||||||
export default Select
|
export default Select
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue