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?

Share Improve this question asked Mar 28 at 5:04 KilianKilian 1,9391 gold badge23 silver badges38 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Updates 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