Skip to main content

Menu

LEVEL 0
0/5 XP
HomeAboutTopicsPricingMy VaultStats

Categories

🤖 Artificial Intelligence
☁️ Cloud and Infrastructure
💾 Data and Databases
💼 Professional Skills
🎯 Programming and Development
🔒 Security and Networking
📚 Specialized Topics
HomeAboutTopicsPricingMy VaultStats
LEVEL 0
0/5 XP
GitHub
© 2026 CheatGrid™. All rights reserved.
Privacy PolicyTerms of UseAboutContact

Svelte Cheat Sheet

Svelte Cheat Sheet

Back to Web Development
Updated 2026-03-10
Next Topic: SvelteKit Meta-Framework Cheat Sheet

Svelte is a compile-time reactive UI framework that compiles components into highly optimized, imperative JavaScript at build time—eliminating the need for a virtual DOM. Unlike traditional frameworks like React or Vue, Svelte shifts work from the browser to the compiler, resulting in smaller bundle sizes and faster runtime performance. Svelte's reactivity is built directly into the language through reactive assignments, labeled statements, and—in Svelte 5—runes that provide explicit, signal-based reactivity. Key mental model: state changes are compiled into surgical DOM updates, not runtime diffing. This makes Svelte feel closer to writing vanilla JavaScript while still offering full framework conveniences like components, stores, and transitions.

What This Cheat Sheet Covers

This topic spans 23 focused tables and 127 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.

Table 1: Component BasicsTable 2: Svelte 5 Runes (Explicit Reactivity)Table 3: Conditional RenderingTable 4: List RenderingTable 5: Async & PromisesTable 6: Data BindingTable 7: Event HandlingTable 8: Lifecycle HooksTable 9: Stores (Shared State)Table 10: Context APITable 11: TransitionsTable 12: AnimationsTable 13: Component CommunicationTable 14: Actions (DOM Enhancements)Table 15: Special ElementsTable 16: StylingTable 17: Reactivity PatternsTable 18: Component Props & ExportsTable 19: Module ContextTable 20: HTML & Text RenderingTable 21: DebuggingTable 22: Advanced Svelte 5 FeaturesTable 23: SvelteKit Basics

Table 1: Component Basics

ConceptExampleDescription
Component structure
<script>
let count = 0;
</script>
<h1>{count}</h1>
A .svelte file contains <script>, markup, and optional <style> — all scoped to the component by default.
Reactive variable (Svelte 4)
let count = 0;
count += 1;
Top-level let declarations are automatically reactive in Svelte 4 — reassignment triggers DOM updates.
Props declaration
let { name, age = 18 } = $props();
• Use $props() in Svelte 5 to declare props
• supports destructuring and default values.
Computed values (Svelte 4)
$: doubled = count * 2;
Prefix with $: to create a reactive declaration that reruns whenever dependencies change.

More in Web Development

  • SolidJS Framework Cheat Sheet
  • SvelteKit Meta-Framework Cheat Sheet
  • AngularJS Cheat Sheet
  • CSS Grid Layout Cheat Sheet
  • Nuxt.js Framework Cheat Sheet
  • shadcn-ui Component Library Cheat Sheet
View all 43 topics in Web Development