You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 5, 2025. It is now read-only.
A component is a reusable self-contained block of code that encapsulates markup, styles and behaviours that belong together.
Like Ractive and Vue, Svelte promotes the concept of single-file components: a component is just an .html file. Here's a simple example:
<h1>Hello {name}!</h1>
As only HTML is used in the .html file, this is either not a demonstration of, or a poor demonstration of the concept of including JS, HTML and CSS in a single file.
Additionally, since the file is called .html there is nothing to suggest there should be more inside the file than what is shown, ie, HTML.
Furthermore the component has data that is given to it later, on instatiation.
Suggestion
In the example below, I have avoided the use of obtuse language, tightened the copy and avoided the term 'SFC' as it does not serve a purpose - Svelte components are explained to be in a single file, we do not need a new acronym for this
Understanding Svelte components
Svelte applications are made from one or more components. In Svelte, like other frameworks, a component is a reusable self-contained block of code with HTML, CSS and JS in a single file.