Skip to content
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

How to use Shadcn? #58

Open
federicofanini opened this issue Oct 22, 2024 · 3 comments
Open

How to use Shadcn? #58

federicofanini opened this issue Oct 22, 2024 · 3 comments

Comments

@federicofanini
Copy link

I encountered issues while trying to install components from Shadcn into my project. The components don’t seem to work as expected, and I believe there may be a problem with the installation process or the integration steps.

How to correctly manage components installations and routes?

I tried npx shadcn@latest add sidebar-09 but it creates many issues.

@iambilalazhar
Copy link

Same problem here.

@jmunckhof
Copy link

Could you share some logs of your errors? Would like to check if I have the same issues.

@bennyweise
Copy link

I'm not sure if this is best practice, but here are the steps I am following to integrate new shadcn components.

  1. In packages/ui, install the new component:
    bunx shadcn@latest add <component>

  2. The component itself probably references the tailwind cn function, which points to the wrong location. Replace the reference to import { cn } from "@/utils" to import { cn } from "../utils"

  3. Add the new component to the exports so it can be picked up by the app - this involves adding a line to packages/ui/package.json in the exports section (just follow the examples already there).

This is probably not the 'correct' way to do it, but it works for me. I'm quite new to front-end dev so it was really a case of trial and error to figure out something that works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants