Packaging shadcn-ui components into a library #6031
-
shadcn-ui workflow works very well for a single app, but has anyone tried to package these components into a library? I am trying to create a standard component library for my organization which can be shared across multiple apps. Any tips would be much appreciated. One approach I have tried is to run the tailwind cli on the app + the library to create the final CSS for the entire app. Another approach I can think of is to package the CSS for the library in it's own bundle, but not sure how I would share the theme with the app (in order to build on top of the library components). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
To create a component library that can be reused across multiple apps, you could bundle the components and Tailwind CSS into a single package. This way, the app can either import the bundled CSS or extend the Tailwind config to customise it. Another approach is to expose your theme variables so the consuming app can adjust the styles as needed. If you’re using Tailwind, it’s generally cleaner to bundle the library’s CSS separately rather than running the Tailwind CLI for each app. |
Beta Was this translation helpful? Give feedback.
To create a component library that can be reused across multiple apps, you could bundle the components and Tailwind CSS into a single package. This way, the app can either import the bundled CSS or extend the Tailwind config to customise it. Another approach is to expose your theme variables so the consuming app can adjust the styles as needed.
If you’re using Tailwind, it’s generally cleaner to bundle the library’s CSS separately rather than running the Tailwind CLI for each app.