Svelte Fundamentals
Svelte is a web user-interface framework that compiles components written with HTML, CSS, and JavaScript into browser code. It tracks reactive state so the page updates when application data changes.
itWeb development | OpenSkills.info
Intro
Svelte Fundamentals
Svelte is a framework for building web user interfaces from components. A component combines markup, behavior, and scoped styles in a .svelte file. During the build, the Svelte compiler turns that declarative component into JavaScript and CSS that update the browser's Document Object Model, or DOM.
The compiler is central to Svelte's design. It analyzes which values a template reads and generates update code around those relationships. The browser still runs a Svelte runtime, but the compiler can move much of the framework's work from page execution to the build step.
Svelte handles the interface layer. It does not, by itself, define routing, server endpoints, data loading, deployment, or an application directory structure. SvelteKit is the companion application framework for those concerns. A standalone Svelte application can also use another router or build integration.
Component anatomy
A .svelte component can contain three optional sections:
- A
<script>block holds instance logic. Top-level values are available to the markup. - Markup describes the rendered elements and child components.
- A
<style>block holds CSS scoped to the component by default.
The file is a superset of HTML. Curly braces insert JavaScript expressions into markup. A component imported with a capitalized name can be used as a markup element. Native lowercase names such as button and input create browser elements.
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://svelte.dev/docs/svelte/overview
Supports
- Svelte as a compiler-based framework for web user interfaces
- Components compiled from HTML, CSS, and JavaScript into optimized JavaScript
- Standalone components and SvelteKit applications
- https://svelte.dev/docs/svelte/svelte-files
Supports
- Component file anatomy and optional sections
- Instance and module script behavior
- Component-scoped style blocks
- https://svelte.dev/docs/svelte/%24state
Supports
- Reactive state and deep proxy behavior
- Raw state, snapshots, arrays, objects, and class limitations
- Destructuring behavior and cross-module state considerations
- https://svelte.dev/docs/svelte/%24derived
Supports
- Derived values and synchronous dependency tracking
- Side-effect-free derived expressions
- Multi-statement derived calculations
- https://svelte.dev/docs/svelte/%24effect
Supports
- Effect scheduling, dependency tracking, and cleanup
- Browser-only effect execution
- Effects as an escape hatch for external synchronization
- Update-cycle and self-triggering failure behavior
- https://svelte.dev/docs/svelte/%24props
Supports
- Props declared through the props rune
- Fallback values and parent-to-child input flow
- Callback properties as component inputs
- https://svelte.dev/docs/svelte/%24bindable
Supports
- Props being non-bindable by default
- Explicit two-way component bindings
- https://svelte.dev/docs/svelte/if
Supports
- Conditional template branches
- https://svelte.dev/docs/svelte/each
Supports
- Iteration over arrays and iterables
- Keyed identity for inserted, moved, and deleted list items
- Empty-list alternatives
- https://svelte.dev/docs/svelte/await
Supports
- Pending, fulfilled, and rejected promise branches
- https://svelte.dev/docs/svelte/key
Supports
- Destruction and recreation when a key expression changes
- https://svelte.dev/docs/svelte/bind
Supports
- Two-way element property bindings
- Value and checked bindings
- https://svelte.dev/docs/svelte/snippet
Supports
- Reusable parameterized markup snippets
- Passing snippets to components
- https://svelte.dev/docs/svelte/%40render
Supports
- Rendering snippets at a call site
- https://svelte.dev/docs/svelte/scoped-styles
Supports
- Compiler-scoped component selectors
- CSS specificity within scoped styles
- https://svelte.dev/docs/svelte/global-styles
Supports
- Explicit global selector behavior
- https://svelte.dev/docs/svelte/lifecycle-hooks
Supports
- Creation and destruction lifecycle boundaries
- onMount, onDestroy, and tick timing
- Server-rendering behavior of lifecycle hooks
- https://svelte.dev/docs/svelte/context
Supports
- Context initialization and descendant access
- Subtree state and server-side shared-state risks
- https://svelte.dev/docs/svelte/stores
Supports
- Store subscription contract
- Stores as an option for asynchronous streams and manual update control
- Shared rune state in Svelte JavaScript and TypeScript modules
- https://svelte.dev/docs/svelte/svelte-boundary
Supports
- Rendering and effect error handling with a Svelte boundary
- Fallback snippets and error reporting
- Exclusion of event and later asynchronous errors
- https://svelte.dev/docs/svelte/compiler-warnings
Supports
- Compiler diagnostics for component correctness and accessibility
- https://svelte.dev/docs/svelte/typescript
Supports
- TypeScript in component script blocks
- https://svelte.dev/docs/svelte/testing
Supports
- Component testing environments and supported test tools
- https://svelte.dev/docs/svelte/svelte-5-migration-guide
Supports
- Runes, snippets, event properties, and function-based components in Svelte 5
- Legacy syntax compatibility and migration paths
- https://svelte.dev/docs/kit/introduction
Supports
- SvelteKit as an application framework using Svelte
- Routing, rendering, data loading, and deployment concerns
- https://svelte.dev/tutorial/svelte/welcome-to-svelte
Supports
- Executable learning path through components and reactivity
- Reference-link rationale
- https://github.com/sindresorhus/awesome
Supports
- Discovery of the Svelte awesome list
- https://github.com/TheComputerM/awesome-svelte
Supports
- Discovery of shadcn-svelte, Melt UI, Superforms, and Svelte Testing Library
- Ecosystem categories for user-interface libraries, forms, and testing
- https://www.shadcn-svelte.com/docs
Supports
- Editable component-code distribution
- Composition, theming, installation, and shared interfaces
- Awesome Links rationale
- https://www.melt-ui.com/docs/introduction
Supports
- Headless component builders
- Accessibility attributes, focus behavior, keyboard interaction, and styling control
- Awesome Links rationale
- https://superforms.rocks/get-started
Supports
- Validation schemas, server load data, form actions, and bound client form state
- Awesome Links rationale
- https://testing-library.com/docs/svelte-testing-library/intro/
Supports
- Svelte component rendering and DOM-oriented testing
- Awesome Links rationale
- https://react.dev/learn
Supports
- React as a component library using JSX, props, state, and rendering
- Landscape comparison with Svelte compilation and templates
- https://vuejs.org/guide/introduction.html
Supports
- Vue single-file components, templates, and reactivity
- Landscape comparison with Svelte runes and bindings
- https://angular.dev/overview
Supports
- Angular as a full web framework with integrated application capabilities
- Landscape comparison with the Svelte and SvelteKit boundary
- https://docs.solidjs.com/quick-start
Supports
- Solid fine-grained reactivity and JSX component model
- Landscape comparison with Svelte compilation and runes
- https://qwik.dev/docs/concepts/resumable/
Supports
- Qwik resumability and server-to-browser interaction model
- Landscape comparison with Svelte hydration and effects
- https://svelte.dev/blog/frameworks-without-the-framework
Supports
- Svelte 1.0 date and compilation approach
- https://svelte.dev/blog/version-2
Supports
- Svelte 2 release date, template changes, lifecycle changes, and modern output
- https://svelte.dev/blog/svelte-3-rethinking-reactivity
Supports
- Svelte 3 release date, assignment-based reactivity, and svelte.dev move
- https://svelte.dev/blog/svelte-and-typescript
Supports
- Official TypeScript support date and consolidated language tooling
- https://svelte.dev/blog/whats-the-deal-with-sveltekit
Supports
- SvelteKit announcement date and succession of Sapper
- Intended routing, rendering, and adapter responsibilities
- https://svelte.dev/blog/sveltekit-beta
Supports
- SvelteKit public beta date, Vite adoption, and adapter model
- https://svelte.dev/blog/announcing-sveltekit-1.0
Supports
- SvelteKit 1.0 date and recommended application-framework status
- https://svelte.dev/blog/svelte-4
Supports
- Svelte 4 date, dependency baselines, package changes, and migration behavior
- https://svelte.dev/blog/runes
Supports
- Runes preview date and reactive design goals
- https://svelte.dev/blog/svelte-5-is-alive
Supports
- Svelte 5 date and stable runes, snippets, event, and component APIs
