HTML / HTML Tags

HTML <Slot> Tag

Oct 12, 2022
1 min read
HTML slot Tag

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:

Specification

Browser Support

Desktop

ChromeEdgeFirefoxIEOperaSafari
YesYesYesNOYesYes

Mobile

Android WebviewChrome AndroidFirefox AndroidOpera AndroidiOS SafariSamsung Internet
YesYesYesYesYesYes