# Templates, Slots and Custom Elements

Write a layout once with a template and named slots, give a card its own layout with declarative shadow DOM and no JavaScript, and use custom elements such as a star rating from a ready-made script.

![Codey's cheat sheet for Templates, Slots and Custom Elements: Write a layout once with a template and named slots, give a card its own layout with declarative shadow DOM and no JavaScript, and use custom elements such as a star rating from a ready-made script.](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/10/abb5acfd072a45f1b571540efd36b169.webp)

- Category: HTML
- Level: Freelancer
- Tags: &lt;slot>, &lt;template>, Custom element, Declarative shadow DOM, html, Named slot, Shadow root
- Updated: October 31, 2026

Source: https://www.ask-codey.com/cheat-sheets/html-templates-slots-and-custom-elements-cheat-sheet
