Which is the best approach to build on top of shadcn/ui? #1907
Replies: 5 comments 5 replies
-
Need some love on this post. |
Beta Was this translation helpful? Give feedback.
-
I'm very curious about this myself. Not being able to style the button with an icon inside without overriding I'd love to be able to customize some of the most commonly used components to match our styleguide so that they are as we want them by default. Any thoughts, recommendations @shadcn ? |
Beta Was this translation helpful? Give feedback.
-
Thank you guys for the interest, I'm back at this because I just saw a video where we are encouraged to override the styles of the component itself. The thing is, and I tested right now with I understand that we have a repository, and we can check the difference once we override that, but it's time-consuming. Besides that, I've also noticed that we probably do not have the That's why I was looking to find a proper way to extend the component we install/download from shadcn/ui. Doing so will allow us to customize the components for our needs while updating them via CLI. Any thought? I have to see if there are some open issues that will improve the situation. |
Beta Was this translation helpful? Give feedback.
-
@AndreaBarghigiani I think the idea is to modify the ui components to fit your needs so I'd recommend doing so. If you want to keep a clean version of the ui library in your repo, you can always have a ui-mirror branch you can use to keep in sync with changes to the latest shadcn/ui registry. You would need to merge your changes in ui-mirror branch to a feature branch or dev branch, keeping main and ui-mirror unconcerned of any conflicting changes they may have. The workflow I would have for this is to use ui-mirror to add or diff components or changes to the ui library, committing them to git so they're tracked and then checking out a feature branch based off main/master branch, and merging ui-mirror changes into the feature branch and fixing any merge conflicts with your custom ui component modifications. You should be able to sync ui-mirror and main while ignoring the ui directory using git rm - not really important though since the ui directory is what you want to maintain in the ui-mirror branch. |
Beta Was this translation helpful? Give feedback.
-
Approach 2 is what I am doing here. In the past I have seen a design system built on top of Chakra. The app would use the components of the DS and a ESLint rule would restrict importing directing from Chakra. I think this is probably the best way to keep shadcn components isolated and upgradable. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all, I've been using this fantastic library for a while now, but I have always used it in side projects and little tools with a short lifespan.
Today, I would like to leverage it to build a new product for the company I am working in. I want to make the right decision that will keep the maintainability and the ease of use, and since I have not found discussions on this topic, I would like to discuss it with you.
On every "introductory video/article" you find around the web, it's obvious that having the component living in the
ui/
folder of your codebase is appreciated. To be honest, this is what I like about it too, but the thing is that many developers talk about the fact that you can customize the component yourself to let it match the design you are working on.The fact is that while this is a fine approach, you have to change the component that comes from the library, and it will break the
diff
command that you get from the CLI.I know this is experimental, but I am trying to figure out the best approach to make it work. Right now, I see those different paths in front of me:
diff
diff
command, even though I believe I'll not be able to keep untouched all of themFrom your experience, which approach would you take and why?
Thanks to anyone who will participate in this discussion.
Beta Was this translation helpful? Give feedback.
All reactions