-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cli): add support for custom ui dir #2266
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
A new prerelease is available for testing: npx shadcn-ui@0.0.0-beta.c68e6ed |
I installed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging. Thanks everyone. |
Seems to be working for me! |
Works perfectly fine components get saved automatically into the preferred path. |
when it will be released? |
yes @tiavina-mika |
* feat(cli): add support for custom ui dir * docs(www): update docs for aliases.ui * chore: add changeset
Thank you. Works as expected. |
works perfectly. Thanks! |
* feat(cli): add support for custom ui dir * docs(www): update docs for aliases.ui * chore: add changeset
This PR adds support for custom dir/path for ui components. It builds on top of the existing schema,
aliases
andresolveImport
.Default schema
This will place components inside
.[ROOT]/components/ui
.Custom
ui
aliasThis will place components inside
.[ROOT]/primitives
. Imports will be resolved automatically.More examples
Help me test this
ui
alias to yourcomponents.json
file.npx shadcn-ui@0.0.0-beta.c68e6ed add
What's an alias?
An alias is an import alias. You can think of it as How do I write imports for my components or utils?.
If you write
import { Button } from "@/components/button"
then@/components
is your alias.import { AlertDialog } from "~/app/ui/alert-dialog"
has alias~/app/ui
.We use aliases instead of paths because it tells us more about your project setup. Using aliases, we can figure out components paths and automatically resolve imports when adding new components.