-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request]: Allow FileUploader internal files state to be mutated #18223
Comments
Thank you for submitting a feature request. Your proposal is open and will soon be triaged by the Carbon team. |
Hi @VadimDez, thanks for opening this issue! For the inputs we try to follow what's available natively in the browser. Unfortunately the I think the best way to approach this would be to run validation after the file(s) upload and present the user an error message if they've selected/uploaded more than what is allowed. |
@tay1orjones thanks for reply, unfortunately internal state is already updated and it's rendering filenames right after the user selects files. I could show an error message, but how do I update the state (files) in FileUploader? |
@VadimDez looks like when FileUploader used to be a class component we exposed a state clearing function via a ref. carbon/packages/react/src/components/FileUploader/FileUploader.tsx Lines 172 to 175 in 261d33c
That could be added back with a |
The problem
Right now we can set
multiple={true}
and select as many files as user wants. No way to limit amount of files to be selected in total.The solution
Adding a new property
max
or modifyingmultiple
property to accept a specific number.Examples
No response
Application/PAL
No response
Business priority
None
Available extra resources
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: