DEV Community

ColtonE37
ColtonE37

Posted on • Edited on

Slots?

Image description

Slots are a HTML element that allows the user to set a placeholder inside of a web component to fill up with any markup. This lets you create multiple DOM trees and present them all together.

Image description

Our latest project, called learning-card, has multiple uses of this element for us to fill with any content we want. Below is the example card that we are trying to replicate.

Image description
This is what we have so far for this project, as there is a lot more to fix and add to this.

Image description

Follow the project: https://github.com/TheKodingKrab/project-two

Top comments (1)

Collapse
 
benoit85 profile image
Eugene • Edited

Nice explanation of how slots work in web components. The placeholder concept is really useful for creating reusable custom elements. On a completely different note, if anyone here enjoys online gaming that's smooth and hassle-free, I recently came across this site and have been impressed by how clean and fast everything runs. No technical glitches, just straightforward entertainment. Worth a look if you need a break from coding.