-
I would like to clear FileInput after the upload is submitted. How can I do that? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @raminrad , I couldn't find a simple way of doing that actually, so I dug a bit into the USWDS implementation of the file input here: https://github.com/uswds/uswds/blob/develop/packages/usa-file-input/src/index.js. It doesn't look like they provide a simple way either, so I went ahead and replicated how they clear the field, based on the user changing the file selections, and ended up create a new custom hook. Here are the details of the current draft PR: #263, including a new story documenting how to make use of this new hook. Prior to merging this, I went ahead and published the following beta version: |
Beta Was this translation helpful? Give feedback.
-
@jbouder Thanks so much... just tested the beta version and works like a charm. Thanks. |
Beta Was this translation helpful? Give feedback.
Hi @raminrad , I couldn't find a simple way of doing that actually, so I dug a bit into the USWDS implementation of the file input here: https://github.com/uswds/uswds/blob/develop/packages/usa-file-input/src/index.js.
It doesn't look like they provide a simple way either, so I went ahead and replicated how they clear the field, based on the user changing the file selections, and ended up create a new custom hook. Here are the details of the current draft PR: #263, including a new story documenting how to make use of this new hook.
Prior to merging this, I went ahead and published the following beta version:
@metrostar/[email protected]
. Can you verify this works for you and get ba…