wc-todo-list
v1.3.0
Published
A todo list "app" built with web components.
Downloads
27
Maintainers
Readme
TodoList WC
A todolist "app" built with web components.
How to use
import "todo-list-wc";
<todo-list>
<input ref="input" type="text">
<button type="button" ref="submit">Add Todo</button>
<ul ref="list">
<!-- ... -->
</ul>
</todo-list>
The <todo-list>
element will automatically add event listeners by looking for the given refs[^1]:
| Ref Name | Expected Element Type |
| - | -: |
| input
| HTMLInputElement
|
| submit
| HTMLButtonElement
|
| list
| HTMLUListElement
[^2] |
[^1]: The elements in the example with a ref
attribute are required. How you place them and the HTML inside the <todo-list>
element is up to you.
[^2]: The list
ref could be swapped for a HTMLOListElement
and work fine, but other list HTMLElements will not work.