mirror of https://github.com/sveltejs/svelte
parent
e4c1c98b2a
commit
57abcb1856
@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
title: Component format
|
||||||
|
---
|
||||||
|
|
||||||
|
Components are the building blocks of Svelte applications. They are written into `.svelte` files, using a superset of HTML:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script>
|
||||||
|
// logic goes here
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* styles go here */
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- markup (zero or more items) goes here -->
|
||||||
|
```
|
||||||
|
|
||||||
|
All three sections — script, styles and markup — are optional.
|
||||||
|
|
||||||
|
|
||||||
|
### Script
|
||||||
|
|
||||||
|
A `<script>` block defines the behaviour for a component.
|
||||||
|
|
||||||
|
* TODO explain run-on-initialisation
|
||||||
|
* export
|
||||||
|
* $:
|
||||||
|
* $
|
||||||
|
|
||||||
|
### Styles
|
||||||
|
|
||||||
|
|
||||||
|
### Markup
|
Loading…
Reference in new issue