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> without any children:

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

<Box/>


		
loading editor...

Console

loading Svelte compiler...


		
loading editor...

Compiler options

result = svelte.compile(source, {
generate:
});


		
loading editor...