Closed franmc01 closed 4 months ago
Did you see the Autocomplete Dropdown? Maybe you can use this
No, I am referring to a dropdown variant where it is allowed to create options in case it is not in the list. Example:
@franmc01 what I have seen others do and makes sense from a UI/UX point of view is use the panelFooterTemplate
to add a "Add New" button: https://primereact.org/dropdown/#template
so if they don't see their item in the list they click "Add New" and you bring up a dialog to allow them to enter a new value and validate etc. I know in PrimeFaces JSF that is what people do but I have not tested it in PrimeReact.
I made an implementation like this and it works well
const onKeyDownAttributeHandler = (event: KeyboardEvent<HTMLInputElement>) => {
if (event.code === 'Enter') {
const { value } = event.target;
const payload = {
name: value.trim(),
}
createAttribute(payload); // rtq hook
}
};
It would be cool to have the same option for MultiSelect
Describe the feature
Is it possible that the editable version enables something like creating an option if it does not exist?
Reproducer
No response
PrimeReact version
latest
React version
18.x
Language
TypeScript
Build / Runtime
Vite
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response