An exploratory collection of widgets
This is a small collection of very simple web components (widgets). I created them as a means to understand the current state of web component (2022) based on the documentation at Mozilla's MDN website. In each example I've attempt to explore a single aspect of the component. This project is hosted at GitHub at github.com/rsdoiel/widgets.
- Getting started
- A minimal component, this doesn't do much beyond inserting itself into the DOM
- A basic component displays a predetermined string as a sub-element. Think of it as a "Hello World" type example.
- A counting component. This has a button and a number displayed beside it. Press the button and the value increments.
- Templated components
- A minimal templated component, displays a box styled with the template's CSS.
- A digital clock component, displays a digital clock in an oval. Clock updates each second after it is instantiated in the page.
- Custom element's attributes, innerHTML and events
- A person name component uses the attributes in the custom element to format the textContent of the element.
- An ORCID component, uses the component's textContent for ORCID identifier
- A person input component, set values of input fields via custom element attributes, when the input fields update the custom element attributes update too. Relies on component life cycle.
- JavaScript example of person-input-component