ui
ui copied to clipboard
Change default ui directory
Is it possible to change the default ui
directory? I'd like the CLI to install new components into @/components/ui-library
instead of @/components/ui
. Thanks
According to CLI docs, there's a -p (or --path) option that should do the trick, however after testing it, that didn't work. It keeps installing the component in the /src/components/ui folder.
Here's what I have tried:
npx shadcn-ui add --path /src/components/ui-library alert
npx shadcn-ui add --path /src/components/ui-library alert
npx shadcn-ui add -p /ui-library alert
https://ui.shadcn.com/docs/cli
There exist many issues related to this bug if you need more info. Here's one of them: https://github.com/shadcn-ui/ui/issues/848#issuecomment-1622524000
This is something I'm looking into. It's currently hardcoded to UI but definitely something that we'll make configurable. Assigning this to me.
Any update on this @shadcn?
@Stefandasbach I haven't had time to look into it yet. For now, as a workaround, you can provide --path when adding components.
-p, --path <path> the path to add the component to.
Looks like this still isn't working with npx shadcn-ui add <component> --path <path>
either.
The workaround doesn't work as well :( I hope this option is enabled soon so adoption for existing projects is easier.
Bumping this up, would love to be able to configure a default path on components.json for CLI to reference
Bump this again, really need this kind of feature
Bump this again, really need this kind of feature
Bump this again, really need this kind of feature
Hoping to have this soon
Bumping again pls add
Change the path setting in the components.json then run the cli again.
Any update on this @shadcn?
@shadcn I know you're busy but I tracked down the line which seems to be blocking the workaround I hesitate to open a PR for it though since it's there for a reason I guess? https://github.com/shadcn-ui/ui/blob/1cf5fad881b1da8f96923b7ad81d22d0aa3574b9/packages/cli/src/utils/registry/index.ts#L121
Update: Back from vacation. Working on this now.
@shadcn if it's a simple fix but you don't have time to work on it, let me know I'd love to sync on it and be able to contribute. And I'm on PTO this week so have the time :)
#2266 closes this
Yes. I believe this is fixed #2266. Please reopen if not. Thank you.