Framework2M+/wkMIT

svelte

Svelte is a radical new approach to building user interfaces that shifts the work of the framework from the browser to a compile step at build time. Unlike Reac

Installation

npm
npm install svelte
yarn
yarn add svelte
pnpm
pnpm add svelte

Import

ESM
// Inside .svelte files

Quick Example

usage
<script>
  let count = $state(0);
</script>

<button onclick={() => count++}>
  Clicked {count} times
</button>

About svelte

Svelte is a radical new approach to building user interfaces that shifts the work of the framework from the browser to a compile step at build time. Unlike React or Vue which use a virtual DOM to detect changes and update the UI, Svelte compiles components into highly efficient imperative code that surgically updates the DOM when state changes. This results in smaller bundle sizes and better runtime performance since there is no framework overhead in the browser. Svelte components are written in .svelte files that combine HTML, CSS, and JavaScript in a single file with an intuitive syntax. Reactive declarations use the $: label, and state is managed with simple variable assignments rather than hooks or observables. Svelte 5 introduced runes, a new reactivity system using $state, $derived, and $effect for more explicit and flexible state management. SvelteKit, the official application framework, provides routing, server-side rendering, and deployment adapters. Svelte is praised for its small learning curve, excellent documentation, and developer satisfaction.

Quick Facts

Packagesvelte
CategoryFramework
Weekly Downloads2M+
LicenseMIT
Installnpm install svelte

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.