From 93eac9b6b36d5d678ba337f7e679b8e3dbdd5dfb Mon Sep 17 00:00:00 2001 From: hcafaq Date: Thu, 16 Feb 2023 12:15:50 +0000 Subject: [PATCH] fix(dropdown): added input ref --- packages/dropdown/src/Dropdown.tsx | 2 ++ packages/dropdown/src/Dropdown.types.ts | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/packages/dropdown/src/Dropdown.tsx b/packages/dropdown/src/Dropdown.tsx index 5d611ddd1..1d593a90a 100644 --- a/packages/dropdown/src/Dropdown.tsx +++ b/packages/dropdown/src/Dropdown.tsx @@ -22,6 +22,7 @@ function Dropdown({ onClick, label, hint, + inputRef, fullWidth, placeholder, error, @@ -126,6 +127,7 @@ function Dropdown({ setStateValue(options[highlightedIndex]); }} placeholder={placeholder} + ref={inputRef} rightIcon={isOpen ? : } value={stateValue?.label} /> diff --git a/packages/dropdown/src/Dropdown.types.ts b/packages/dropdown/src/Dropdown.types.ts index 4b52b28b9..c31173d3a 100644 --- a/packages/dropdown/src/Dropdown.types.ts +++ b/packages/dropdown/src/Dropdown.types.ts @@ -55,4 +55,8 @@ export type DropdownProps = { * The label of the dropdown component */ label?: React.ReactNode; + /** + * The input ref of the dropdown component + */ + inputRef?: React.Ref; };