Quick Start
This guide will walk you through adding your first animation component to your Svelte 5 project. We’ll use the Shimmer Button component as an example, which creates a beautiful traveling light effect around a button.This guide assumes you’ve already completed the Installation steps. If you haven’t, please set up your project first.
Your First Animation Component
Install the Component
Let’s install the Shimmer Button component using the CLI:This will create the following files in your project:
Each component follows a consistent structure with a main
.svelte file and an index.ts for clean exports.Add Required CSS
The Shimmer Button requires custom CSS animations. Add these to your global CSS file:
src/routes/+layout.css
Use the Component
Now you can use the Shimmer Button in your pages. Open That’s it! You now have a beautiful animated button with a shimmer effect.
src/routes/+page.svelte and add:src/routes/+page.svelte
Customize the Component
All components accept props for customization. Let’s customize the shimmer effect:
src/routes/+page.svelte
Available Props:
shimmerColor- Color of the shimmer effect (default:"#ffffff")shimmerSize- Thickness of the shimmer (default:"0.05em")shimmerDuration- Animation speed (default:"3s")borderRadius- Border radius (default:"100px")background- Button background (default:"rgba(0, 0, 0, 1)")class- Additional Tailwind classes
Try Another Component
Let’s add a text animation to complement our button:Complete Example: Morphing Text Hero
Here’s a more complete example using the Morphing Text component:Understanding Component Structure
All Svelte 5 Animations components follow this pattern:Key Svelte 5 Features:
$props()rune for reactive propsSnippettype for renderable content{@render children?.()}for rendering child content- TypeScript interfaces for type safety
Common Patterns
Combining Multiple Animations
You can layer multiple animation components:Conditional Rendering
Use Svelte’s reactivity with animations:Responsive Animations
Use Tailwind’s responsive utilities:Component Discovery
To find the component URL for CLI installation:- Visit any component page in the documentation
- Look for the installation command
- The URL follows this pattern:
- Morphing Text:
https://sv-animations.vercel.app/r/morphing-text.json - Shimmer Button:
https://sv-animations.vercel.app/r/shimmer-button.json - Animated Beam:
https://sv-animations.vercel.app/r/animated-beam.json
Next Steps
Now that you understand the basics:Browse Components
Explore all 56+ available animation components
Component Structure
Understand how components are organized
Installation Methods
Learn CLI and manual installation options
Customization
Learn how to customize and extend components
Tips & Best Practices
Customization Tips:
- All components support the
classprop for additional Tailwind classes - Use CSS variables for theme-based customization
- Modify the component source directly for deeper changes
- Combine components creatively for unique effects
Getting Help
If you run into issues:- Check the component’s documentation page for specific requirements
- Visit the GitHub repository to report issues
- Follow @Sikandar_Bhide on Twitter for updates
- Review the source code - it’s in your project!