Definition
The <slot>
tag is identified by its name
attribute. It allows you to define a placeholder in your template that can be filled with your markup.
Example
<section id='keyInformationSection'>
<h2>Key Information:</h2>
<!-- Slot information will go here -->
</section>
<!-- Template for the key information -->
<template id='keyInformationTemplate'>
<slot name='keyInformation'></slot>
</template>
Usage
- Both the opening and closing tags are required.
- A
name
attribute is required to assign the<slot>
a name.
Attributes
The <slot>
element only supports the Global Attributes, along with the following:
name
The
name
attribute specifies the<slots>
name.
Specification
Browser Support
Desktop
Chrome | Edge | Firefox | IE | Opera | Safari |
---|---|---|---|---|---|
Yes | Yes | Yes | NO | Yes | Yes |
Mobile
Android Webview | Chrome Android | Firefox Android | Opera Android | iOS Safari | Samsung Internet |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |