A ListboxOption must have a value prop. #885
Replies: 1 comment
-
@cristianpascottini if the Listbox behaved as though it were using React's typings for an As to why e.g. a number is not allowed, I suppose a case could be made to allow it, and change the conditional to <Listbox onChange={(value) => {
console.log(Number(value));
}}>
<ListboxOption value="0">Option 0</ListboxOption>
<ListboxOption value="1">Option 1</ListboxOption>
<ListboxOption value="2">Option 2</ListboxOption>
</Listbox> One of Reach's philosophies is to be as close to HTML behavior as possible. And while HTML will let you pass e.g. a number as an option's value, the value being submitted as form data will be serialized as a string anyway. Is there a specific non-string value case you are attempting to create? |
Beta Was this translation helpful? Give feedback.
-
Hi!
Can you please explain the ratio behind this?
Why is it not possible to let a
ListboxOption
have an empty string as a value? Or even the number0
?Are there other ways to do it?
Many thanks.
Beta Was this translation helpful? Give feedback.
All reactions