-
Hi, I am trying to implement a Combobox that has both a function for displaying an objects property as value and a placeholder. This seems to be not possible, my approach was to return undefined in the <Combobox.Input
displayValue={(myObject) =>
myObject ? myObject.name : undefined
}
placeholder="My placeholder"
// [...]
/> Unfortunately, this does not seem to work. Returning the placeholder in the displayValue function does not work either, as my styling depends on the presence of a placeholder. Is there something I am missing here? Any hint would be greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Nevermind, I solved this myself: You can just return an empty string in the displayValue function, the Combobox.Input will then show the placeholder instead. <Combobox.Input
displayValue={(myObject) =>
myObject ? myObject.name : ""
}
placeholder="My placeholder"
// [...}
/> should work. |
Beta Was this translation helpful? Give feedback.
Nevermind, I solved this myself: You can just return an empty string in the displayValue function, the Combobox.Input will then show the placeholder instead.
So something like:
should work.