Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Svelte 3 Up and Running

You're reading from   Svelte 3 Up and Running A fast-paced introductory guide to building high-performance web applications with SvelteJS

Arrow left icon
Product type Paperback
Published in Aug 2020
Publisher Packt
ISBN-13 9781839213625
Length 168 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Alessandro Segala Alessandro Segala
Author Profile Icon Alessandro Segala
Alessandro Segala
Arrow right icon
View More author details
Toc

Other useful Svelte features

We've tried designing our journaling app to make use of most of the features of Svelte 3 that you're likely to adopt when building your own apps, but we could not fit them all in. The rest of this chapter will lightly touch on some more features of the Svelte compiler and runtime that might be useful to you.

Slots

Slots allow parents to pass markup to child components.

In the child component, define the place for a slot with the <slot>...</slot> syntax; you can optionally put some default (fallback) content inside.

An example of this can be seen in the following code snippet:

Child.svelte

<h1>Here's the child component</h1>
<div style="margin: 0 2em;">
    <slot>
        <p style="color: #999">This is the default              content &lt...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime