Skip to content

Commit 17a7cf5

Browse files
authored
docs: clarify ordering of attributes with spread (#15917)
1 parent ae71152 commit 17a7cf5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

documentation/docs/03-template-syntax/01-basic-markup.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,14 @@ As with elements, `name={name}` can be replaced with the `{name}` shorthand.
8282
<Widget foo={bar} answer={42} text="hello" />
8383
```
8484

85+
## Spread attributes
86+
8587
_Spread attributes_ allow many attributes or properties to be passed to an element or component at once.
8688

87-
An element or component can have multiple spread attributes, interspersed with regular ones.
89+
An element or component can have multiple spread attributes, interspersed with regular ones. Order matters — if `things.a` exists it will take precedence over `a="b"`, while `c="d"` would take precedence over `things.c`:
8890

8991
```svelte
90-
<Widget {...things} />
92+
<Widget a="b" {...things} c="d" />
9193
```
9294

9395
## Events

0 commit comments

Comments
 (0)