Svelte – Slot Fallbacks

0 min read


Box.svelte

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

<style>
	.box {
		width: 300px;
		border: 1px solid #aaa;
		border-radius: 2px;
		box-shadow: 2px 2px 8px rgba(0,0,0,0.1);
		padding: 1em;
		margin: 0 0 1em 0;
	}
</style>

App.svelte

	<ClickOutside />
	<LongpressActions />
	<PannableActions />
	<ClassDirective />
	<ShortHand />
	<Slots />
	<Box>
		<h2>Hello!</h2>
		<p>This is a box. It can contain anything.</p>
	</Box>
	<Box/>

dan hasilnya akan seperti ini

Allright link github ada disini.. cyaaa…

Bima Sena

Leave a Reply

Your email address will not be published. Required fields are marked *