Svelte logo

Svelte by Example: Hello World

Let's get started!

In this example, we'll build a small hello world component.

Svelte components use the .svelte file extension. A component can contain a template, script, and style.

Valid HTML is a valid Svelte component. Here's the most basic component you can make: a plain text string.

HelloWorld.svelte
Hello, world!

Since we're building for the web, let's add HTML.

HelloWorld.svelte
<p>Hello, world!</p>