Skip to content

Commit

Permalink
feat(Dropdown): add inputValue and blurInputOnSelect properties to al…
Browse files Browse the repository at this point in the history
…low editing options (#2608)
  • Loading branch information
eliyapl authored Nov 24, 2024
1 parent dfd3777 commit 074c12c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/core/src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ const Dropdown: VibeComponent<DropdownComponentProps, HTMLElement> & {
filterOption,
menuPosition = Dropdown.menuPositions.ABSOLUTE,
"data-testid": dataTestId,
withGroupDivider = false
withGroupDivider = false,
inputValue,
blurInputOnSelect
}: DropdownComponentProps,
ref: React.ForwardedRef<HTMLElement>
) => {
Expand Down Expand Up @@ -458,6 +460,8 @@ const Dropdown: VibeComponent<DropdownComponentProps, HTMLElement> & {
loadingMessage={loadingMessage}
tabSelectsValue={tabSelectsValue}
filterOption={filterOption}
inputValue={inputValue}
blurInputOnSelect={blurInputOnSelect}
{...asyncAdditions}
{...additions}
/>
Expand Down
9 changes: 8 additions & 1 deletion packages/core/src/components/Dropdown/Dropdown.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,14 @@ export interface DropdownComponentProps extends CustomMenuBaseProps, CustomOptio
* createFilter function is available at Dropdown.createFilter
*/
filterOption?: (option: DropdownOption, inputValue: string) => boolean;

/**
* The current value of the input field, used to control the current value of the input field programmatically
*/
inputValue?: string;
/**
* If true, the input field will lose focus when an option is selected
*/
blurInputOnSelect?: boolean;
withReadOnlyStyle?: boolean;
OptionRenderer?: React.ReactNode;
menuIsOpen?: boolean;
Expand Down

0 comments on commit 074c12c

Please sign in to comment.