Build a packing checklist! Each row can be ticked off, the summary keeps score, and one button clears the whole list.
The component holds four items in this order: 1 Passport, 2 Charger, 3 Toothbrush, 4 Snacks. Every item starts unpacked.
Render them inside a <ul class="items">, one <li> per item carrying data-id set to the item id. Each row contains an <input type="checkbox" class="toggle"> — also carrying the row data-id — followed by a <span class="label"> holding the item name.
A row that is packed must have the class item packed; a row that is not packed has just item. Templates cannot compute inline, so map the class in a getter.
Below the list render a <p class="summary"> whose text is exactly Packed: X of Y, where X is how many items are packed and Y is the total number of items — so the first render reads Packed: 0 of 4.
Finally render a <button class="reset">Reset</button> that marks every item unpacked again.
Examples:
Initial render:
<ul class="items">
<li class="item" data-id="1"><input type="checkbox" class="toggle" data-id="1" /><span class="label">Passport</span></li>
<li class="item" data-id="2">...Charger...</li>
<li class="item" data-id="3">...Toothbrush...</li>
<li class="item" data-id="4">...Snacks...</li>
</ul>
<p class="summary">Packed: 0 of 4</p>
<button class="reset">Reset</button>
Tick the checkbox in row 1 -> <li class="item packed" data-id="1"> and <p class="summary">Packed: 1 of 4</p>
Tick rows 1 and 3 -> the rows carrying class packed are 1 and 3
Tick row 2 and then untick it -> no row carries the packed class
Tick some rows and click Reset -> <p class="summary">Packed: 0 of 4</p>