MDN self-hosted library · e01.org

Element: slot property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

html
<my-paragraph>
  <span slot="my-text">Let's have some different text!</span>
</my-paragraph>
js
let slottedSpan = document.querySelector("my-paragraph span");
console.log(slottedSpan.slot); // logs 'my-text'