Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/JenniferSmith007/reusable_WebComponent_VanillaJS

Defining a custom HTML elements by creating a reusable comment element and making it dynamic with state.
https://github.com/JenniferSmith007/reusable_WebComponent_VanillaJS

custom-component custom-element dom html-elements shadow-dom state-management template vanilla-javascript web-components

Last synced: 3 months ago
JSON representation

Defining a custom HTML elements by creating a reusable comment element and making it dynamic with state.

Awesome Lists containing this project

README

        

# πŸ”¨ Building a Reusable Comment Component πŸ› 

### Project Description:

Defining a custom HTML elements by creating a reusable comment element. The comment element with attributes to take in the content, you create an unlimited number of identically structured and styled comments with different content, and placing them by hand in the HTML.

### Task:

- Use Custom Elements: Can take a name, email address, and comment as an attribute.

- Display the name, email address, and attribute, in a custom layout that’s built-in to the component

### What was done:

- Using the DOM, built a form and custom HTML element with attributes
- created a template element to hold the information

- Created a class that extends HTML
- using the class to attach Shadow DOM and append the template

- Defined the class and element with DOM customElements.define

#### * Second Branch explains how to make the comment component dynamic with basic state and built in Shadow DOM methods ➞ ➞ ➞