--- url: "https://web.dev/learn/html/template" titulek: "Template, slot, and shadow | web.dev" h1: "Template, slot, and shadow Stay organized with collections Save and categorize content based on your preferences." popis: "'An explanation of template, slot, and shadow.'" jazyk: "en" kanonicka: "https://web.dev/learn/html/template" drobecky: ["web.dev", "Resources", "HTML"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-13 22:28:55" znaku: 14989 slov: 2121 kodovani: "iso-8859-2" sha256: "4c70b34e0b6a039016b71f932ad4a36d6117c3965b5ab5090c3bfaaf2f26703c" --- Template, slot, and shadow Stay organized with collections Save and categorize content based on your preferences. The benefit of web components is their re-usability: you can create a UI widget once, and reuse it multiple times. While you do need JavaScript to create web components, you don't need a JavaScript library. HTML and the associated APIs provide everything you need. The Web Component standard is made up of three parts—[HTML templates](https://developer.mozilla.org/docs/Web/Web_Components/Using_templates_and_slots), [Custom Elements](https://developer.mozilla.org/docs/Web/Web_Components/Using_custom_elements), and the [Shadow DOM](https://developer.mozilla.org/docs/Web/Web_Components/Using_shadow_DOM). Combined, they enable building customized, self-contained (encapsulated), reusable elements that can be seamlessly integrated into existing applications, like all the other HTML elements we've already covered. In this section, we'll create the `` element, a web component that allows users to rate an experience on a scale of one to five stars. When naming a custom element, it is recommended to use all lowercase letters. Also, include a dash, as this helps distinguish between regular and custom elements. We'll discuss using the `