Custom slots

Custom slots are a way for you to allow users of your theme to insert their own custom HTML into specified areas of your theme.

The same way users pass in the media slot for their media element, they can pass in other markup for a custom slot that you define.

For example, if you want to create a "cta" slot for users to pass in a call to action button, you can create a slot called "cta".

<template id="my-slots-theme">
    <slot name="media" slot="media"></slot>
    <slot name="cta" slot="centered-chrome"></slot>

<media-theme template="my-slots-theme">
  <a slot="cta" href="/buy" class="button">Buy my course!</a>

Buy my course!

Slotted nodes exist in the light DOM

Section titled Slotted nodes exist in the light DOM

Slotted nodes exist in the light DOM (as opposed to the Shadow DOM). This has the advantage of being able to use styles from the parent page. In the example above the class button are styles coming from the user’s application, not the theme itself.