Skip to content

feat(FileUpload): expose removeFile in slots#6492

Open
cydrickn wants to merge 1 commit into
nuxt:v4from
cydrickn:fix-fileupload-file-slot
Open

feat(FileUpload): expose removeFile in slots#6492
cydrickn wants to merge 1 commit into
nuxt:v4from
cydrickn:fix-fileupload-file-slot

Conversation

@cydrickn
Copy link
Copy Markdown

Resolves #6491

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ 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)

📚 Description

The file and file-trailing slots in UFileUpload did not expose the removeFile function, making it impossible to trigger file removal from within a custom slot template.

This change passes removeFile as a slot prop to both file and file-trailing, consistent with how files-top and files-bottom already expose it. Users can now do:

<UFileUpload multiple>
  <template #file="{ file, index, removeFile }">
    <div class="w-full">{{ file.name }}</div>
    <button @click="removeFile(index)">Remove</button>
  </template>
</UFileUpload>

📝 Checklist

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

@cydrickn cydrickn requested a review from benjamincanac as a code owner May 24, 2026 06:44
@github-actions github-actions Bot added the v4 #4488 label May 24, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 24, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

The FileUpload component now exposes a removeFile(index?: number) callback through its scoped slots. The FileUploadSlots type is updated to include removeFile on the files, file, and file-trailing slot prop objects. The component template is changed to pass remove-file into the files slot and into each per-file file and file-trailing slot so slot consumers can remove files via the provided callback.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the issue, the solution, provides a practical example, and links to the related issue #6491.
Linked Issues check ✅ Passed The PR fully addresses issue #6491 by exposing removeFile in the file and file-trailing slots, matching the objective to provide parity with other slots and enable custom file removal.
Out of Scope Changes check ✅ Passed All changes are directly related to the linked issue objective of exposing removeFile in file and file-trailing slots, with no out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title accurately describes the main change: exposing the removeFile function in file-related slots of the FileUpload component.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 24, 2026

npm i https://pkg.pr.new/@nuxt/ui@6492

commit: 23dc0fc

@cydrickn cydrickn force-pushed the fix-fileupload-file-slot branch from 7ca8a23 to 23dc0fc Compare May 24, 2026 07:12
@cydrickn cydrickn changed the title fix(FileUpload): add removeFile to file and file trailing slots feat(FileUpload): add removeFile to file and file trailing slots May 24, 2026
@benjamincanac benjamincanac changed the title feat(FileUpload): add removeFile to file and file trailing slots feat(FileUpload): expose removeFile in slots May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding removeFile function to be passed to FileUpload file slot

2 participants