diff --git a/site/content/docs/02-template-syntax.md b/site/content/docs/02-template-syntax.md index 2c665376dcf6..0e0e8e400822 100644 --- a/site/content/docs/02-template-syntax.md +++ b/site/content/docs/02-template-syntax.md @@ -1328,6 +1328,28 @@ Named slots allow consumers to target specific areas. They can also have fallbac ``` +Components can be placed in a named slot using the syntax ``. +In order to place content in a slot without using a wrapper element, you can use the special element ``. + +```sv + +
+ No header was provided +

Some content between header and footer

+ +
+ + + + + +

All rights reserved.

+

Copyright (c) 2019 Svelte Industries

+
+
+``` + + #### [`$$slots`](slots_object) --- @@ -1537,3 +1559,25 @@ The `` element provides a place to specify per-component compile ```sv ``` + +### `` + +The `` element allows you to place content in a [named slot](docs#slot_name) without wrapping it in a container DOM element. This keeps the flow layout of your document intact. + +```sv + +
+ No header was provided +

Some content between header and footer

+ +
+ + + +

Hello

+ +

All rights reserved.

+

Copyright (c) 2019 Svelte Industries

+
+
+``` diff --git a/site/content/tutorial/16-special-elements/08-svelte-fragment/app-a/App.svelte b/site/content/tutorial/16-special-elements/08-svelte-fragment/app-a/App.svelte new file mode 100644 index 000000000000..35f258685770 --- /dev/null +++ b/site/content/tutorial/16-special-elements/08-svelte-fragment/app-a/App.svelte @@ -0,0 +1,10 @@ + + + +
+

All rights reserved.

+

Copyright (c) 2019 Svelte Industries

+
+
diff --git a/site/content/tutorial/16-special-elements/08-svelte-fragment/app-a/Box.svelte b/site/content/tutorial/16-special-elements/08-svelte-fragment/app-a/Box.svelte new file mode 100644 index 000000000000..16c17f90ef26 --- /dev/null +++ b/site/content/tutorial/16-special-elements/08-svelte-fragment/app-a/Box.svelte @@ -0,0 +1,20 @@ + + +
+ No header was provided +

Some content between header and footer

+ +
diff --git a/site/content/tutorial/16-special-elements/08-svelte-fragment/app-b/App.svelte b/site/content/tutorial/16-special-elements/08-svelte-fragment/app-b/App.svelte new file mode 100644 index 000000000000..6f55903ece7b --- /dev/null +++ b/site/content/tutorial/16-special-elements/08-svelte-fragment/app-b/App.svelte @@ -0,0 +1,10 @@ + + + + +

All rights reserved.

+

Copyright (c) 2019 Svelte Industries

+
+
diff --git a/site/content/tutorial/16-special-elements/08-svelte-fragment/app-b/Box.svelte b/site/content/tutorial/16-special-elements/08-svelte-fragment/app-b/Box.svelte new file mode 100644 index 000000000000..16c17f90ef26 --- /dev/null +++ b/site/content/tutorial/16-special-elements/08-svelte-fragment/app-b/Box.svelte @@ -0,0 +1,20 @@ + + +
+ No header was provided +

Some content between header and footer

+ +
diff --git a/site/content/tutorial/16-special-elements/08-svelte-fragment/text.md b/site/content/tutorial/16-special-elements/08-svelte-fragment/text.md new file mode 100644 index 000000000000..fca7aeb8441a --- /dev/null +++ b/site/content/tutorial/16-special-elements/08-svelte-fragment/text.md @@ -0,0 +1,35 @@ +--- +title: +--- + +The `` element allows you to place content in a named slot without wrapping it in a container DOM element. This keeps the flow layout of your document intact. + +In the example notice how we applied a flex layout with a gap of `1em` to the box. + +```sv + + + +
+ No header was provided +

Some content between header and footer

+ +
+``` + +However, the content in the footer is not spaced out according to this rhythm because wrapping it in a div created a new flow layout. + +We can solve this by changing `
` in the `App` component. Replace the `
` with ``: + +```sv + +

All rights reserved.

+

Copyright (c) 2019 Svelte Industries

+
+```