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 - Interactive selection with direction-detecting hover, keyboard nav, swipe gesturesCardStackMotionFlip.svelte - 3D roll effect with 4-directional swipe using FLIP animationInfinite 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:
bun install
Set up environment variables (optional):
cp .env.example .env
# Edit .env with your Neon database URL
Run the development server:
bun run dev
Open your browser:
Navigate to http://localhost:5173
The component demos now label whether data came from the database, static fixtures, or a database error path. Authentication and write flows require a real Postgres connection.
# Auth tables
database/schema_better_auth.sql
# Component demo tables
database/schema.sql
database/schema_v2.sql
.env:DATABASE_URL=your_connection_string_here
BETTER_AUTH_SECRET=your_long_random_secret
BETTER_AUTH_URL=http://localhost:5173
Auth pages show "Auth Offline" until DATABASE_URL, BETTER_AUTH_SECRET, and BETTER_AUTH_URL are configured.
For local OSS demos, you can seed an explicit demo login after the auth schema exists:
bun run seed:demo-user
That creates [email protected] with password test1. The seed is manual-only and refuses to run with NODE_ENV=production unless explicitly overridden.
For the hosted OSS demo, set PUBLIC_DEMO_AUTH=true after seeding the demo database. That exposes a "Try demo" login on the sign-in page. The public demo account is treated as read-only for mutating API routes until user-owned demo data is in place.
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 # Demo fixture 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 .envdatabase/schema_better_auth.sql has been run before using authbun install to ensure dependencies are up-to-date.svelte-kit directory and rebuildBuilt with Svelte 5, TypeScript, and modern web technologies.