An Interest In:
Web News this Week
- March 22, 2024
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
October 26, 2021 05:43 am GMT
Original Link: https://dev.to/liamkirkland/slots-in-custom-web-components-5fgd
Slots in Custom Web Components
During development of any custom web component, slots can be extremely useful. Slots allow for use to pass in HTML into different parts of our card.
Below we see the cards we are trying to replicate.
Slots are ultimately useful in structuring a custom element. While our group is still trying to fully utilize slots in our component, we see the benefits of the structure they provide. We are on our way to properly using slots to their fullest.
render() { return html` <div class="cardWhole"> <div class="cardHeader"> <slot name="top-header"></slot> <slot name="bottom-header></slot> </div> <div class="cardBody"> <p> content body </p> <ul> <li>1</li> <li>2</li> <li>3</li> </ul> </div> </div> `; }
Original Link: https://dev.to/liamkirkland/slots-in-custom-web-components-5fgd
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To