A collection of reusable, well-documented Svelte 5 component templates. Each component is production-ready, fully commented, and designed to be easily copied into your projects.
Interactive horizontal card displays with hover and swipe interactions. Perfect for image galleries, product showcases, or content carousels.
Variants:
CardStack.svelte - Basic CSS-only versionCardStackAdvanced.svelte - Enhanced with swipe gestures and keyboard navigationCardStackMotionSpring.svelte - Spring physics animations via svelte-motionCardStackMotionFlip.svelte - FLIP animation techniqueInfinite scrolling content displays for logos, testimonials, or featured content.
Variants:
Marquee.svelte - Static scroll with pause-on-hoverMarqueeDraggable.svelte - Interactive with drag-to-scroll and momentumCards with mouse-tracking spotlight effects and dynamic border glow. Perfect for feature highlights or premium content.
File: MagicCard.svelte
Animated border wrapper with horizontal shine animation. Zero dependencies, pure CSS animations.
File: ShineBorder.svelte
Animated CTA button with text slide animation and background expansion. No icon library dependencies.
File: SwishButton.svelte
Card with layout transitions between compact and expanded states using Svelte's built-in transitions.
File: ExpandingCard.svelte
Links with image preview on hover using blur transitions. Perfect for documentation and references.
File: LinkImageHover.svelte
Responsive navigation with mobile hamburger menu and smooth panel animations.
File: Navbar.svelte
Animated navigation menu with staggered entrance animations and active state highlighting.
File: StaggeredMenu.svelte
src/lib/components/<script>
import CardStack from '$lib/components/CardStack.svelte';
const cards = [
{ image: '/image.jpg', title: 'Title', content: 'Description' }
];
</script>
<CardStack {cards} />
Clone the repository:
git clone <repository-url>
cd tfeSvelteTemplates
Install dependencies:
npm install
Set up environment variables (optional):
cp .env.example .env
# Edit .env with your Neon database URL
Run the development server:
npm run dev
Open your browser:
Navigate to http://localhost:5173
The demo includes Neon database integration for all components, but everything works with fallback data if no database is configured.
# First, run database/schema.sql (CardStack data)
# Then, run database/schema_v2.sql (Marquee, ExpandingCard, LinkImageHover data)
.env:DATABASE_URL=your_connection_string_here
Note: If you don't set up a database, the app will use fallback data automatically. Each page displays a status indicator showing whether it's using database or fallback data.
tfeSvelteTemplates/
āāā src/
ā āāā lib/
ā ā āāā components/ # Reusable components
ā ā ā āāā CardStack.svelte
ā ā ā āāā Marquee.svelte
ā ā ā āāā ExpandingCard.svelte
ā ā ā āāā LinkImageHover.svelte
ā ā ā āāā DatabaseStatus.svelte
ā ā āāā server/ # Server utilities
ā ā ā āāā cards.ts
ā ā ā āāā testimonials.ts
ā ā ā āāā expandingCards.ts
ā ā ā āāā linkPreviews.ts
ā ā āāā types.ts # TypeScript interfaces
ā ā āāā constants.ts # Fallback data
ā ā āāā utils.ts # Helper functions
ā āāā routes/
ā ā āāā api/cards/
ā ā ā āāā +server.ts # API endpoint
ā ā āāā +page.svelte # Home page
ā ā āāā +page.server.ts # Server-side data loading
ā ā āāā cardstack/
ā ā āāā marquee/
ā ā āāā expandingcard/
ā ā āāā linkimagehover/
ā āāā app.html # HTML template
āāā database/
ā āāā schema.sql # CardStack data schema
ā āāā schema_v2.sql # Additional components schema
āāā static/ # Static assets
āāā .env.example # Environment variables template
āāā package.json # Dependencies
āāā svelte.config.js # SvelteKit configuration
āāā tsconfig.json # TypeScript configuration
āāā README.md # This file
Each component includes:
| Prop | Type | Default | Description |
|---|---|---|---|
cards |
Card[] |
[] |
Array of card objects with image, title, content |
cardWidth |
number |
300 |
Width of card container in pixels |
cardHeight |
number |
400 |
Height of card container in pixels |
partialRevealSide |
'left' | 'right' |
'right' |
Which side stays hidden on hover |
interface Card {
image?: string; // Optional image URL
title?: string; // Optional title text
content?: string; // Optional HTML content
}
All properties are optional, allowing flexibility in card content.
All components are designed to be easily customised:
<style> sectioncardWidth and cardHeight propsThe project is pre-configured with the Vercel adapter.
.env files are excluded from git via .gitignore.env.example provided as a template (no sensitive data)This project is intended as a template collection. Feel free to use, modify, and integrate these components into your projects.
This is a template library. If you create additional templates following the same principles (well-commented, easy to use, production-ready), contributions are welcome!
For issues or questions:
Note: Backdrop filter may not work on older browsers but degrades gracefully.
cards array is passed to the componentDATABASE_URL is set in .envnpm install to ensure dependencies are up-to-date.svelte-kit directory and rebuildBuilt with Svelte 5, TypeScript, and modern web technologies.