Skip to content

feat(FileUpload): add fileImage prop#5935

Merged
benjamincanac merged 10 commits intonuxt:v4from
mdotme:feat/file-upload/preview-file
Mar 11, 2026
Merged

feat(FileUpload): add fileImage prop#5935
benjamincanac merged 10 commits intonuxt:v4from
mdotme:feat/file-upload/preview-file

Conversation

@mdotme
Copy link
Contributor

@mdotme mdotme commented Jan 26, 2026

🔗 Linked issue

Resolves #5918

❓ 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

📝 Checklist

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

@mdotme mdotme requested a review from benjamincanac as a code owner January 26, 2026 05:58
@github-actions github-actions bot added the v4 #4488 label Jan 26, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 26, 2026

📝 Walkthrough

Walkthrough

A new optional previewFile prop is added to the FileUpload component to control whether file previews are generated and displayed. The createObjectUrl function's return type is updated from string to string | undefined to reflect that it may not generate a blob URL. When previewFile is false, the function returns undefined; otherwise, it creates and returns a blob URL as before. Minor default value adjustments accompany the new prop.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title mentions 'fileImage' prop but the actual implementation adds a 'previewFile' prop to control file preview generation. Update the PR title to 'feat(FileUpload): add previewFile prop' to accurately reflect the actual prop name and change being made.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description is related to the changeset, indicating the PR resolves issue #5918 and documents the type of change (enhancement and new feature).
Linked Issues check ✅ Passed The PR fully addresses issue #5918 by implementing a previewFile prop to disable image previews, allowing consistent placeholder behavior across file types.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the previewFile prop feature requested in issue #5918; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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

pkg-pr-new bot commented Jan 26, 2026

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

commit: 5f565cc

@benjamincanac benjamincanac changed the title feat: add previewFile prop to UFileUpload feat(FileUpload): add previewFile prop Jan 28, 2026
@benjamincanac
Copy link
Member

@mdotme Sorry for the delay, I've been hesitant merging this as I find the previewFile naming a bit confusing, do you have other suggestions?

@mdotme
Copy link
Contributor Author

mdotme commented Mar 9, 2026

@benjamincanac yeah you're right that was the only thing came to my mind. Since currently it's previewing only the image maybe 'previewImage` is good? but I'm not sure

@benjamincanac
Copy link
Member

What about fileImage next to fileIcon? Setting it to true means we display the image of the file, wdyt?

@mdotme
Copy link
Contributor Author

mdotme commented Mar 10, 2026

Yeah that works for the current case. My thought was if you're planning to add other file previews would we have to add like fileVideo, fideoPdf props too? Probably I'm overthinking. For now I'll just add fileImage then, just let me know if other changes should be made 🙌

@benjamincanac
Copy link
Member

I'm not sure how we could render a PDF or a video without adding heavy dependencies 😬

Copy link
Member

@benjamincanac benjamincanac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should rename previewFile to fileImage.

@mdotme
Copy link
Contributor Author

mdotme commented Mar 10, 2026

We should rename previewFile to fileImage.

done!

@mdotme mdotme requested a review from benjamincanac March 10, 2026 15:24
@benjamincanac benjamincanac changed the title feat(FileUpload): add previewFile prop feat(FileUpload): add fileImage prop Mar 10, 2026
@mdotme mdotme requested a review from benjamincanac March 11, 2026 02:54
@benjamincanac benjamincanac merged commit 40f9c2e into nuxt:v4 Mar 11, 2026
17 checks passed
@benjamincanac
Copy link
Member

Thanks! 😊

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.

disable FileUpload image preview

2 participants