Simple patterns appear very similar to most popular UI frameworks. Two-way bindings can be declared (for compatible components) with a `$` prefix on their properties. Here is a list with bidirectional binding and inline handlers: ```tsx import { Default, NAME, pattern, UI, Writable, equals } from "commontools"; interface Item { title: string; done: Default; } interface Input { items: Writable; } export default pattern(({ items }) => ({ [NAME]: "Shopping List", [UI]: (
{items.map((item) => (
{item.title} { const current = items.get(); const index = current.findIndex((el) => equals(item, el)); if (index >= 0) items.set(current.toSpliced(index, 1)); }}>×
))} { const text = e.detail.message?.trim(); if (text) items.push({ title: text, done: false }); }} />
), items, })); ``` **Key points:** - `$checked` automatically syncs - no handler needed - Inline handlers for add/remove operations - **Uses `equals()` for item identity** - Ternary in `style` attribute works fine - Type inference works in `.map()` - no annotations needed