Skip to content

How to reset FileInput #262

Answered by jbouder
raminrad asked this question in Q&A
Sep 17, 2024 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

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…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by raminrad
Comment options

You must be logged in to vote
2 replies
@jbouder
Comment options

@jbouder
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants