how to use Combobox with useForm ? #7077
Answered
by
rtivital
byungmin12
asked this question in
Q&A
-
Dependencies check up
What version of @mantine/* packages do you have in package.json?7.13.2 What package has an issue?@mantine/form What framework do you use?Vite In which browsers you can reproduce the issue?None Describe the bugI used combobox to customize options with useForm. <Combobox
store={combobox}
onOptionSubmit={val => {
setValue(val);
typeInputProps.onChange(val);
combobox.closeDropdown();
onChange(val);
}}
>
<Combobox.Target>
<InputBase
variant="unstyled"
component="button"
type="button"
pointer
key={inputKey}
rightSection={<Combobox.Chevron />}
rightSectionPointerEvents="none"
onClick={() => combobox.toggleDropdown()}
{...typeInputProps}
>
<TypeBadge type={(value as EFieldType) ?? EFieldType.STRING} />
</InputBase>
</Combobox.Target>
<Combobox.Dropdown>
<Combobox.Options>{options}</Combobox.Options>
</Combobox.Dropdown>
</Combobox> If possible, include a link to a codesandbox with a minimal reproductionNo response Possible fixNo response Self-service
|
Beta Was this translation helpful? Give feedback.
Answered by
rtivital
Nov 5, 2024
Replies: 1 comment 1 reply
-
Combobox component is not an input, it should be used to create a component which it then can be integrated with useForm. To create such component:
You can learn more on how to build custom components that support these properties by exploring Mantine components source code, |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
byungmin12
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Combobox component is not an input, it should be used to create a component which it then can be integrated with useForm. To create such component:
value
andonChange
propsdefaultValue
andonChange
propsYou can learn more on how to build custom components that support these properties by exploring Mantine components source code,