layout | title | label | permalink | nav_order | parent |
---|---|---|---|---|---|
page |
Using slots to Insert Elements in Web-Components |
Using slots |
/usage-web-components/slots/ |
8 |
Usage |
Slots are part of the native web-component. Because Lego builds native web-components, you can use the standard slots as documented.
Example:
index.html
<user-profile>
<span>This user is in Paris</span>
<user-profile>
bricks/user-profile.html
<template>
<h1>User profile</h1>
<p>important information: <slot></slot></p>
</template>
Will write …<p>important information: <span>This user is in Paris</span></p>