/*{ "parent": "binding", "description": "Reactive list bindings: surgical updates via id-paths, virtualized rendering for million-row lists, sticky headers, filtering, and grids." }*/ /*# # binding arrays The most likely source of complexity and performance issues in applications is displaying large lists or grids of objects. `tosijs` provides robust support for handling this efficiently. ## `.tosi.listBinding()` The simplest way to bind an array is with `.tosi.listBinding()` (or `.listBinding()` directly on a BoxedProxy). It takes a template builder function that receives the `elements` proxy and a placeholder item for bindings: ```js import { elements, tosi } from 'tosijs' const { listBindingExample } = tosi({ listBindingExample: { array: ['this', 'is', 'an', 'example'] } }) const { h3, ul } = elements preview.append( h3('binding an array of strings'), ul( ...listBindingExample.array.tosi.listBinding(({li}, item) => li(item)) ) ) ``` ### listBinding(templateBuilder, options?) => [ElementProps, HTMLTemplateElement] type ListTemplateBuilder = (elements: ElementsProxy, item: U) => HTMLElement The template builder receives two arguments: the `elements` proxy (destructure the tags you need) and a placeholder proxy for the array item. Property access on the placeholder creates relative bindings (`^.name`, `^.score`, etc.) automatically. Spread the result into a container element — it returns an `[ElementProps, HTMLTemplateElement]` tuple. The props (containing `bindList`) are applied to the container and the `