How can I safely remove specific shadCN UI components from my Next.js project?? #143976
-
|
I'm using ShadCN components in a Next.js project, and I need to remove some UI components that are no longer necessary. I want to make sure they’re removed cleanly, without leaving any unused imports, dependencies, or configurations that might affect app performance or cause errors. Here’s what I’d like help with:
Any tips on best practices for cleanly removing components in a Next.js project using ShadCN and Tailwind CSS would be really helpful! |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 6 replies
-
|
Thanks for posting in the GitHub Community, @bipanshu-kumar! We're happy you're here. You are more likely to get a useful response if you are posting your question in the applicable category, the Discussions category is solely related to conversations around the GitHub product Discussions. This question should be in the Programming Help category. I've gone ahead and moved it for you. Good luck! |
Beta Was this translation helpful? Give feedback.
-
Cleanly Removing UI Components in a Next.js Project with ShadCN and Tailwind CSSThis guide outlines the steps to cleanly remove UI components in a Next.js project, ensuring no unused imports, dependencies, or configurations remain. 1. Remove Component Files
2. Search for Unused Imports
For example: import { UnusedComponent } from "@/components/ui"; |
Beta Was this translation helpful? Give feedback.
-
|
I ran into a similar issue recently. What I ended up doing was checking the code of each specific component under /components/ui to understand its dependencies, and then manually removing the unused dependencies/devDependencies from package.json. I plan to do this from now on, using |
Beta Was this translation helpful? Give feedback.
-
|
https://www.npmjs.com/package/shadcn-remover I was working on a Next.js project with Shadcn and needed to delete some components. check out my repo |
Beta Was this translation helpful? Give feedback.
-
|
Hey @bipanshu-kumar! We're going through discussions that haven't been marked as answered yet. Did the replies from other members help you resolve the issue you raised? If so, can you please mark their response as the answer? When you mark a question as an answer, GitHub will highlight the comment and replies to the comment to help visitors quickly find the answer. |
Beta Was this translation helpful? Give feedback.
-
Introducing: shadcn-remover CLI While working on a Next.js project with Shadcn, I added a lot of UI components. Later wanted to remove some of them, I realized there was no easy way to do it. It automates the cleanup process and comes packed with useful features. Check out the full feature list on the GitHub repo and the package README. Your support through stars and shares is greatly appreciated! Thanks for using and sharing the shadcn-remover CLI! NPM: https://www.npmjs.com/package/shadcn-remover |
Beta Was this translation helpful? Give feedback.
-
|
Yes sir!
…On Sun, Jul 20, 2025, 1:46 PM Humayun Kabir ***@***.***> wrote:
@exodus-tola-mindCoder <https://github.com/exodus-tola-mindCoder>, Does
this shadcn-remover <https://www.npmjs.com/package/shadcn-remover>
package also remove this dependencies safely?
—
Reply to this email directly, view it on GitHub
<#143976 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BNMLZMOEHXSMNVADMCB45BT3JNXPTAVCNFSM6AAAAABRNWMXUSVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGOBSGM2TCOA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.

Cleanly Removing UI Components in a Next.js Project with ShadCN and Tailwind CSS
This guide outlines the steps to cleanly remove UI components in a Next.js project, ensuring no unused imports, dependencies, or configurations remain.
1. Remove Component Files
/components/uifolder or their respective location.2. Search for Unused Imports