ui icon indicating copy to clipboard operation
ui copied to clipboard

feat(upload): add resetUpload method to clear uploaded files

Open onaranyusuf opened this issue 8 months ago โ€ข 0 comments

๐Ÿ”— Linked issue

N/A

โ“ Type of change

  • [ ] ๐Ÿ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • [ ] ๐Ÿž Bug fix (a non-breaking change that fixes an issue)
  • [ ] ๐Ÿ‘Œ Enhancement (improving an existing functionality like performance)
  • [x] โœจ New feature (a non-breaking change that adds functionality)
  • [ ] ๐Ÿงน Chore (updates to the build process or auxiliary tools and libraries)
  • [ ] โš ๏ธ Breaking change (fix or feature that would cause existing functionality to change)

Do we need to publish a new version of a package?

  • [x] Add a changeset pnpm changeset and select what semver changes your PR is adding
    • commit and push the generated changeset file

๐Ÿ“ Checklist

  • [ ] I have linked an issue or discussion.
  • [ ] I have updated the documentation accordingly.

๐Ÿ“š Description

This PR adds a new method resetUpload() to the component.

It allows:

  • Manually clearing selected file(s)
  • Resetting validation state (e.g., after successful form submission)
  • Resetting native input value to allow re-upload of the same file

Currently, there is no built-in way to programmatically reset the upload input. This makes it difficult to clear the component after successful form submissions or cancellation actions. This method provides a clean, predictable way to reset the UI and internal state.

Tested successfully in a Nuxt 3 app using both direct usage and custom wrapper components.

onaranyusuf avatar Apr 18 '25 21:04 onaranyusuf