Aller au contenu principal
Academind
Tous les cours

Cours Academind Pro

Web Components & Stencil.js - Build Custom HTML Elements

A Complete Introduction to building Custom HTML Elements/ Web Components with and without StencilJS

  • 10 sections · 147 leçons
  • 8 h et 45 min au total
Web Components & Stencil.js - Build Custom HTML Elements

À propos de ce cours

You’ve built plenty of UIs with the HTML tags the browser gives you—and you’ve also hit the moment where you wish <tabs>, a <side-drawer>, or a <modal> just existed. Copy-pasting markup and JavaScript between projects gets old fast, and frameworks aren’t always the answer.

In this course, you’ll use Web Components (native custom HTML elements) to create re-usable building blocks with just HTML, CSS, and JavaScript. You’ll start with what the browser already supports, then use Stencil.js to make more complex components easier to build with a modern workflow.

By the end, you’ll be able to ship your own lightweight custom elements, style them safely, pass data in and out, and wire them into real apps—whether you’re using Angular, React, Vue, or no framework at all.

Ce que vous allez apprendre

You’ll go from native browser Web Components to a Stencil.js workflow that helps you build and share custom elements across projects and frameworks.

  1. 01

    Create custom elements

    Build re-usable, lightweight custom HTML elements using native browser features, so you can package UI behavior into tags you can drop into any project.

  2. 02

    Build complex UI components

    Implement components of different complexity levels—from a simple tooltip up to UI patterns like modals and side drawers—without relying on Angular, React, or Vue.

  3. 03

    Pass data into components

    Feed data into your web components and use it internally, so your custom elements can be configured and re-used with different inputs across pages and apps.

  4. 04

    Emit custom events

    Create and dispatch your own events from inside a component, then listen to them in JavaScript to react to user interactions and component state changes.

  5. 05

    Scope styles with Shadow DOM

    Use the Shadow DOM to keep CSS styles encapsulated within your custom elements, preventing style leakage and avoiding conflicts with the rest of the page.

  6. 06

    Work efficiently with Stencil.js

    Use Stencil.js features to streamline development of native web components, including a workflow that leverages TypeScript and JSX (taught in the course).

Prérequis

  • Basic JavaScript knowledge (base syntax, DOM basics, object basics).

  • ES6+ JavaScript (e.g. const, let, classes) is recommended but not required; a brief refresher is included.

  • No prior Angular/React/Vue, TypeScript, or JSX knowledge is required.

À qui s’adresse ce cours

  • Curious web builders

    You want to create your own custom HTML tags and stop re-creating the same UI patterns in every project. This course gives you a clear path to doing that with browser-native tech.

  • Framework-agnostic developers

    You work across different stacks (or switch often) and need UI pieces you can re-use anywhere. Web Components let you share the same elements across Angular, React, Vue, or plain JavaScript apps.

  • Future-focused students

    You’re looking for a future-proof web technology that’s built into the browser and fits into any web app. You want something practical you can apply immediately without needing deep framework expertise.

Programme

Découvrez la structure et le rythme de ce cours avant de commencer.

  1. 1Introduction9 leçons · 27 min
    1. 01Introduction1:38 min
    2. 02Web Components - A Quick Demo6:30 min
    3. 03What are Web Components3:22 min
    4. 04Join our Online Learning Community0:00 min
    5. 05Why Do We Use Web Components?3:05 min
    6. 06Comparing Web Components & Frameworks6:15 min
    7. 07Course Outline2:46 min
    8. 08How To Get The Most Out Of The Course3:04 min
    9. 09The Academind Pro Referral Program0:00 min
  2. 2Refreshing Next Generation JavaScript (Optional)11 leçons · 35 min
    1. 01Module Introduction1:12 min
    2. 02Understanding "let" and "const"3:05 min
    3. 03Working with Arrow Functions5:27 min
    4. 04Exports and Imports4:43 min
    5. 05Understanding Classes4:30 min
    6. 06Classes, Properties and Methods3:03 min
    7. 07The Spread & Rest Operator6:27 min
    8. 08Refreshing Array Functions2:32 min
    9. 09JS Array Functions2:32 min
    10. 10Understanding Async Code1:04 min
    11. 11Next-Gen JavaScript - Summary0:00 min
  3. 3Understanding the Basics22 leçons · 1 h et 32 min
    1. 01Module Introduction - What are Web Components?5:07 min
    2. 02Browser Support3:05 min
    3. 03Our Development Setup4:38 min
    4. 04Creating our First Custom Element8:28 min
    5. 05Interacting with the Surrounding DOM5:04 min
    6. 06Understanding the Custom Elements Lifecycle2:51 min
    7. 07Using "connectedcallback" for DOM Access2:05 min
    8. 08Listening to Events Inside the Component8:52 min
    9. 09Using Attributes on Custom Elements4:45 min
    10. 10"Attributes" vs "Properties"0:00 min
    11. 11Styling our Elements4:08 min
    12. 12Using the Shadow DOM5:00 min
    13. 13Adding an HTML Template5:40 min
    14. 14Using Slots1:50 min
    15. 15Defining the Template in JavaScript3:29 min
    16. 16Using Style Tags in the Shadow DOM2:40 min
    17. 17Extending Built-In Elements7:33 min
    18. 18Time to Practice: The Basics - Problem2:55 min
    19. 19Time to Practice: The Basics - Solution11:31 min
    20. 20Debugging0:00 min
    21. 21Wrap Up2:30 min
    22. 22Useful Resources & Links0:00 min
  4. 4Diving Deeper Into Web Components16 leçons · 52 min
    1. 01Module Introduction0:51 min
    2. 02Understanding Shadow DOM Projection2:26 min
    3. 03Styling "slot" Content Outside of the Shadow DOM3:44 min
    4. 04Styling "slot" Content Inside the Shadow DOM3:10 min
    5. 05Styling the Host Component4:42 min
    6. 06Styling Components from Outside0:00 min
    7. 07Conditional Host Styling2:49 min
    8. 08Styling with the Host Content in Mind2:27 min
    9. 09Smart Dynamic Styling with CSS Variables6:20 min
    10. 10Cleaning Up Our Overall Styling3:22 min
    11. 11Observing Attribute Changes6:17 min
    12. 12Adjusting the Component Behaviour Upon Attribute Changes2:34 min
    13. 13Using "disconnectedcallback"4:40 min
    14. 14Adding a Render Method6:13 min
    15. 15Wrap Up2:33 min
    16. 16Useful Resources & Links0:00 min
  5. 5Building More Complex Components15 leçons · 1 h et 4 min
    1. 01Module Introduction0:52 min
    2. 02Creating the Basics Modal Component6:33 min
    3. 03Adding the Modal Container2:29 min
    4. 04Styling the Modal Elements5:35 min
    5. 05Adding Some General App Logic3:49 min
    6. 06Opening the Modal via CSS5:23 min
    7. 07Public Methods & Properties6:37 min
    8. 08Understanding Named Slots5:45 min
    9. 09"slotchange" & Getting Access to Slot Content5:10 min
    10. 10Closing the Modal with Modal Buttons7:01 min
    11. 11Dispatching Custom Events3:40 min
    12. 12Configuring Custom Events4:52 min
    13. 13Adding Enhancements & Modal Animations4:50 min
    14. 14Wrap Up1:48 min
    15. 15Useful Resources & Links0:00 min
  6. 6Stencil - An Introduction9 leçons · 21 min
    1. 01Module Introduction1:21 min
    2. 02Using Web Components in Modern Browsers2:35 min
    3. 03Browser Support for Web Components2:27 min
    4. 04Using Web Components in All Browsers0:00 min
    5. 05Creating a Stencil Project2:59 min
    6. 06What is Stencil?3:09 min
    7. 07Stencil.js behind the Scenes0:00 min
    8. 08Diving Into a First Stencil Component6:56 min
    9. 09Wrap Up1:41 min
  7. 7Stencil - Diving Into the Basics22 leçons · 1 h et 22 min
    1. 01Module Introduction0:35 min
    2. 02Using the Development Server3:19 min
    3. 03MUST READ: Ensuring Correct Imports0:00 min
    4. 04Creating a New Stencil Web Component8:55 min
    5. 05Styling a Stencil Component5:40 min
    6. 06Using Props7:02 min
    7. 07Important: Reflect Props to Attributes0:00 min
    8. 08Configuring Props1:27 min
    9. 09Using Slots & Styling4:54 min
    10. 10Rendering Conditional Content2:08 min
    11. 11Using Attributes for Styling only3:27 min
    12. 12Using Props in Combination with Attributes4:16 min
    13. 13Understanding Mutable Props5:33 min
    14. 14Preparing Tabs3:33 min
    15. 15Adding More Event Listeners4:23 min
    16. 16Using State4:32 min
    17. 17Adding Methods to Components3:40 min
    18. 18Adding a Backdrop5:20 min
    19. 19Time to Practice: Stencil - Problem1:13 min
    20. 20Time to Practice: Stencil - Solution10:04 min
    21. 21Wrap Up1:52 min
    22. 22Useful Resources & Links0:00 min
  8. 8Advanced Stencil28 leçons · 1 h et 52 min
    1. 01Module Introdution0:38 min
    2. 02Creating a New Component2:48 min
    3. 03Component & API Preparations3:57 min
    4. 04Submitting Forms2:09 min
    5. 05Styling the Component5:49 min
    6. 06HTTP Requests in Components7:43 min
    7. 07Using the API Key2:23 min
    8. 08Accessing the Host Element5:14 min
    9. 09Using References2:52 min
    10. 10Two Way Binding & Input Validation6:32 min
    11. 11Error Handling6:07 min
    12. 12Using the "componentdidload" Lifecycle Hook5:34 min
    13. 13All Lifecycle Hooks5:16 min
    14. 14Using Update Lifecycle Hooks4:41 min
    15. 15Watching Prop Changes4:47 min
    16. 16Creating a New Component5:56 min
    17. 17Styling the New Component1:11 min
    18. 18Outputting a List of Elements6:20 min
    19. 19Styling the List Items2:11 min
    20. 20Emitting Customs Events4:47 min
    21. 21Using the Listen Decorator6:05 min
    22. 22Using Hostdata4:37 min
    23. 23Adding a Loading Spinner3:53 min
    24. 24Embedding Components Into Components4:54 min
    25. 25Using CSS Properties4:32 min
    26. 26Using Stencil.js to Build Entire Apps0:00 min
    27. 27Wrap Up1:25 min
    28. 28Useful Resources & Links0:00 min
  9. 9Deployment & Publishing13 leçons · 37 min
    1. 01Module Introduction0:54 min
    2. 02Using Stencil Config4:59 min
    3. 03Building & Using the Components4:15 min
    4. 04Using Web Components in a Node.js Project2:10 min
    5. 05Publishing to NPM3:24 min
    6. 06Installing NPM Packages1:27 min
    7. 07Using Web Components in an Angular App5:32 min
    8. 08Using Web Components in a React App5:18 min
    9. 09Using Web Components in a Vue App4:31 min
    10. 10Polyfills & The Internet Explorer2:49 min
    11. 11IE & Polyfills0:00 min
    12. 12Wrap Up1:25 min
    13. 13Useful Resources & Links0:00 min
  10. 10Roundup2 leçons · 3 min
    1. 01Roundup2:58 min
    2. 02Useful Resources & Links0:00 min

Prêt à commencer ?

Achetez ce cours sur Academind Pro, ou obtenez tous les cours avec All Access sur Academind Infinite.

Black Friday : un an d’All Access pour 249 $US 249 $US · seulement jusqu’au Profitez de l’offre
  • Ce cours sur Academind Pro

    69 $USpaiement unique

    TVA incluse · Satisfait ou remboursé pendant 30 jours

    • Accès à vie à ce cours
    • Toutes les futures mises à jour de ce cours
    • Ressources téléchargeables, code et un certificat
    Acheter Web Components
  • All Access sur Academind Infinite

    25 $USpar mois

    ou 249 $US 249 $US par anÉconomisez 17 %

    • Tous les cours, avec toutes leurs fonctionnalités
    • Les nouveaux cours dès leur sortie
    • Votre tuteur, avec toutes ses fonctionnalités
    Obtenir All Access

All Access inclut aussi tous les cours Academind Pro.

Academind Pro et Academind Infinite

Deux plateformes distinctes, chacune avec ses propres cours et sa propre connexion.

Academind Pro

Notre plateforme de cours d’origine, sur pro.academind.com. Votre abonnement Pro et les cours que vous y avez achetés restent sur Pro.

Se connecter à Academind Pro

Academind Infinite

Notre nouvelle plateforme pensée pour l’IA. Les membres Pro se connectent avec leur compte Pro, et l’offre Pro All Access inclut Infinite : tous les cours leur sont ouverts.

Se connecter à Academind Infinite

Vous aviez un compte Pro ou avez acheté un cours sur Pro ?

Tous les cours Pro ne sont pas passés sur Infinite, seulement ceux-ci. Choisissez le vôtre pour le voir sur Infinite.