0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-30 17:00:40 +01:00
svelte/site/content/tutorial/14-composition/02-slot-fallbacks/text.md
2019-03-10 09:30:29 -04:00

400 B

title
Slot fallbacks

A component can specify fallbacks for any slots that are left empty, by putting content inside the <slot> element:

<div class="box">
	<slot>
		<em>no content was provided</em>
	</slot>
</div>

We can now create instances of <Box> eithout any children:

<Box>
	<h2>Hello!</h2>
	<p>This is a box. It can contain anything.</p>
</Box>

<Box/>