The :bind attribute is a useful feature for spreading object properties directly onto child components, but it has no dedicated documentation section in html-syntax.md.
What :bind does
Instead of passing individual named props, :bind spreads an object's keys directly as flat properties on the receiving component — so the child can reference them by name without any wrapper object.
Suggested addition
Add a new Binding objects section in docs/html-syntax.md, inserted right after the Conditionals section, covering:
- Basic usage:
<component :bind="obj"/> spreads all keys of obj as props
- Shorthand for looping:
<product-card :each="item in products" :bind="item"/>
- Using
{ this } to spread the current component's own data
- Reactivity: when the bound object is replaced, the child re-renders
Real-world example (from blog.html)
<author :bind="authors[author || authors.default]"/>
<author class="author row">
<img src="{ img }">
<h3>{ name }</h3>
<a href="//x.com/{ username }">@{ username }</a>
</author>
The authors[...] object is spread, so img, name, and username are accessible flat inside <author>.
References
- Implementation:
packages/nuedom/src/dom/node.js (getAttrData function)
- Tests:
packages/nuedom/test/component.test.js (:bind and :bind this)
The
:bindattribute is a useful feature for spreading object properties directly onto child components, but it has no dedicated documentation section inhtml-syntax.md.What
:binddoesInstead of passing individual named props,
:bindspreads an object's keys directly as flat properties on the receiving component — so the child can reference them by name without any wrapper object.Suggested addition
Add a new Binding objects section in
docs/html-syntax.md, inserted right after the Conditionals section, covering:<component :bind="obj"/>spreads all keys ofobjas props<product-card :each="item in products" :bind="item"/>{ this }to spread the current component's own dataReal-world example (from
blog.html)The
authors[...]object is spread, soimg,name, andusernameare accessible flat inside<author>.References
packages/nuedom/src/dom/node.js(getAttrDatafunction)packages/nuedom/test/component.test.js(:bindand:bind this)