-
will DropDown and ComboBox in V9 ever have "options" props ? Dose it always be a SomeArray.map of ? |
Beta Was this translation helpful? Give feedback.
Answered by
smhigley
Dec 27, 2022
Replies: 1 comment 3 replies
-
The v9 ones don't take options props since the options are defined as children, using the 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>
);
}); |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
Ofer-Gal
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 anoptions
prop instead of children with something like this: