1
Create project
Start by creating a new Astro project:
2
Configure your Astro project
You will be asked a few questions to configure your project:
3
Add Svelte to your project
Install Svelte using the Astro CLI:
Answer
Yes to all the question prompted by the CLI when installing Svelte.4
Add TailwindCSS to your project
Add Tailwind CSS using the Astro CLI:
Answer
Yes to all the question prompted by the CLI when installing TailwindCSS.5
Import the global CSS file
Import the
global.css file in the src/pages/index.astro file:src/pages/index.astro
6
Setup path aliases
Add the following code to the
tsconfig.json file to resolve paths:tsconfig.json
If needed, adapt the path aliases to your specific needs (learn more about it).
7
Run the CLI
Run the
shadcn-svelte init command to setup your project:8
Configure components.json
You will be asked a few questions to configure
components.json:9
That's it
You can now start adding components to your project.The command above will add the
Button component to your project. You can then import it like this:index.astro
Remember to use the
client directives inside .astro files when dealing with interactive components (learn more about it).