Skip to content
Discussion options

You must be logged in to vote

The v9 ones don't take options props since the options are defined as children, using the <Option> component. It would be pretty simple to extend the v9 Combo or Dropdown to take an options prop instead of children with something like this:

type CustomOptionType = {
  key: string;
  text: string;
  // any other data
};

type CustomComboboxProps = ComboboxProps & {
  children: never;
  options: CustomOptionType[];
};

const CustomCombobox: ForwardRefComponent<ComboboxProps> = React.forwardRef((props, ref) => {
  return (
    <Combobox>
      {props.options.map((option) => {
        <Option key={option.key}>{option.text}</Option>
      })}
    </Combobox>
  );
});

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Ofer-Gal
Comment options

@smhigley
Comment options

@Dan86de
Comment options

Answer selected by Ofer-Gal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants