web-components-examples
web-components-examples copied to clipboard
EditableList's attribute-based approach makes for a confusing example
Taking list items as individual items is a pretty awkward API that people are using as an example of why web components have a bad API. It's a poor argument - you can make a similar component API in any framework - but there's no reason IMO to design a component this way. It would be far more ergonomic to take a list of items as a property, a JSON array as an attributes, and/or a list of child elements.
Thanks for reporting. Is the suggestion to do something like this?
<editable-list
title="TODO"
items='["one", "two", "three"]'
...
></editable-list>
To help anyone reading through / investigating:
- demo: https://mdn.github.io/web-components-examples/editable-list/
- example src: https://github.com/mdn/web-components-examples/tree/main/editable-list