Installation
This guide will walk you through setting up a new Svelte 5 project with all the dependencies required for Svelte 5 Animations.Prerequisites
Before you begin, make sure you have:- Node.js 18.x or later
- npm, pnpm, or yarn package manager
- Basic familiarity with SvelteKit and Tailwind CSS
This guide uses
pnpm in examples, but you can use npm or yarn if you prefer. The CLI commands will automatically detect your package manager.Quick Start Installation
Create SvelteKit Project
Start by creating a new SvelteKit project with Tailwind CSS:Navigate to your project directory:
Initialize shadcn-svelte
Initialize shadcn-svelte, which provides the CLI tool for installing components:
You can use the default configuration or customize it to fit your project’s needs. The CLI will guide you through the setup process.
Install motion-sv
Install the motion-sv animation library, which powers the animations:
motion-sv is a required dependency for all animation components. It provides the core animation primitives and utilities.
Manual Installation
If you prefer not to use the CLI, you can manually copy components into your project:Copy Component Files
Visit any component page in the documentation, copy the component code, and paste it into the appropriate directory.For example, for Shimmer Button:
Add Required Styles (if needed)
Some components require additional Tailwind CSS configuration or keyframe animations. Check the component documentation for any required CSS additions.For example, Shimmer Button requires these keyframes in your global CSS:
src/routes/+layout.css
Install Component Dependencies
Some components may require additional npm packages beyond motion-sv. Check the component documentation for specific dependencies.Common additional dependencies include:
runed- For advanced reactivity utilities@neoconfetti/svelte- For confetti effectsbits-ui- For accessible UI primitives
Project Structure
After installation, your project structure should look like this:Dependencies Overview
Here’s a breakdown of the key dependencies:Core Dependencies
- @sveltejs/kit (^2.49.1) - SvelteKit framework
- svelte (^5.45.6) - Svelte 5 with runes
- tailwindcss (^4.1.17) - Utility-first CSS framework
- motion-sv (^0.1.10) - Animation library for Svelte
Supporting Libraries
- shadcn-svelte (^1.1.0) - Component CLI and architecture
- bits-ui (^2.15.4) - Headless UI components
- clsx (^2.1.1) - Conditional class name utility
- tailwind-merge (^3.4.0) - Merge Tailwind classes
- tailwind-variants (^3.2.2) - Component variants utility
Optional Dependencies (Component-Specific)
- runed - Advanced reactivity utilities
- @neoconfetti/svelte - Confetti effects
- mode-watcher - Dark mode utilities
Optional dependencies are only needed for specific components. Check individual component documentation to see what’s required.
Verify Installation
To verify everything is set up correctly:-
Start the development server:
-
Open your browser to
http://localhost:5173 - You should see the SvelteKit welcome page with no errors
Troubleshooting
If you encounter issues:- Check that all dependencies are installed:
pnpm install - Verify your
package.jsonincludes the required dependencies - Make sure you’re using Node.js 18.x or later
- Clear your
.svelte-kitbuild cache and restart the dev server