admin管理员组文章数量:1355825
Shadcn advertises itself as a base layer to easily build your own component library. When using the cli to install the components, in a NextJS project, the full code is stored in the components/ui
folder.
How should customization of these components be handled?
As an example I would like to add a cursor-pointer
on all checkboxes by default. Is the code in components/ui/checkbox.ts
directly modified?
My confusion:
If the auto installed code is modified locally how are components updated when shadcn publishes a new version and makes changes to a component on their side? Will the ci be able to download the new component and merge the changes with what locally happened (git like)?
Or should developers create a new component that derives on the base component? In that case what would be the point of having the full code in the repository in the first place?
Or are updates by shadcn not regularly happening anyways and it's a manual task?
Shadcn advertises itself as a base layer to easily build your own component library. When using the cli to install the components, in a NextJS project, the full code is stored in the components/ui
folder.
How should customization of these components be handled?
As an example I would like to add a cursor-pointer
on all checkboxes by default. Is the code in components/ui/checkbox.ts
directly modified?
My confusion:
If the auto installed code is modified locally how are components updated when shadcn publishes a new version and makes changes to a component on their side? Will the ci be able to download the new component and merge the changes with what locally happened (git like)?
Or should developers create a new component that derives on the base component? In that case what would be the point of having the full code in the repository in the first place?
Or are updates by shadcn not regularly happening anyways and it's a manual task?
1 Answer
Reset to default 0Updates are happening somewhat regularly (sometimes monthly, sometimes ever few months). In this post they are saying that updates only affect the package.json
. Only if you are running the npx command again, your code will be overwritten. I guess, if you need the visual updates (when they eventually emerge), you'll either leave it as is or manually adjust to the new style if you want to preserve your adjustments.
I'd assume that fundamental changes in the tsx/ts files are happening rarely and if so contain big changes which are either not worth implementing or keeping your adjustments.
本文标签: reactjsHow to customize shadcn components while maintaining updateabilityStack Overflow
版权声明:本文标题:reactjs - How to customize shadcn components while maintaining updateability? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744055834a2583233.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论