@@ -161,7 +161,50 @@ This is intentional. Most UI patterns only need to react to *selection changes*,
161161
162162When you need reactive collections, v0 provides three patterns.
163163
164- ### Pattern 1: Events
164+ ### Pattern 1: reactive option
165+
166+ Enable reactivity at creation time with ` { reactive: true } ` :
167+
168+ ``` ts
169+ import { createRegistry } from ' @vuetify/v0'
170+
171+ const registry = createRegistry ({ reactive: true })
172+
173+ // Now collection access is reactive
174+ registry .values () // Triggers reactivity
175+ registry .size // Triggers reactivity
176+ ```
177+
178+ ``` vue playground
179+ <script setup>
180+ import { createRegistry } from '@vuetify/v0'
181+
182+ const registry = createRegistry({ reactive: true })
183+
184+ let count = 0
185+ function onAdd() {
186+ registry.register({
187+ id: `item-${count++}`,
188+ value: `Item ${count}`,
189+ })
190+ }
191+ </script>
192+
193+ <template>
194+ <button @click="onAdd">Add Item</button>
195+ <p>Count: {{ registry.size }}</p>
196+ <ul>
197+ <li v-for="item in registry.values()" :key="item.id">
198+ {{ item.value }}
199+ </li>
200+ </ul>
201+ </template>
202+ ```
203+
204+ > [ !TIP]
205+ > The ` reactive ` option uses ` shallowReactive ` internally—top-level changes trigger updates, but nested object mutations won't.
206+
207+ ### Pattern 2: Events
165208
166209Subscribe to specific changes imperatively:
167210
@@ -181,12 +224,12 @@ registry.on('unregister:ticket', function (ticket) {
181224
182225Events are lightweight and precise—you react only to what you care about.
183226
184- ### Pattern 2 : useProxyRegistry
227+ ### Pattern 3 : useProxyRegistry
185228
186229Wrap any registry for full template reactivity:
187230
188231``` ts
189- import { useProxyRegistry } from ' @vuetify/v0'
232+ import { createRegistry , useProxyRegistry } from ' @vuetify/v0'
190233
191234const registry = createRegistry ()
192235const proxy = useProxyRegistry (registry )
@@ -226,24 +269,6 @@ const proxy = useProxyRegistry(registry)
226269> [ !TIP]
227270> ` useProxyRegistry ` automatically enables events on the underlying registry. You only pay the reactivity cost when you use the proxy.
228271
229- ### Pattern 3: toReactive
230-
231- Convert a ref's contents to a reactive object for cleaner access:
232-
233- ``` ts
234- import { ref } from ' vue'
235- import { toReactive } from ' @vuetify/v0'
236-
237- const source = ref ({ count: 0 , name: ' test' })
238- const state = toReactive (source )
239-
240- // Access without .value
241- state .count // 0
242- state .name // 'test'
243- ```
244-
245- Useful when you have a ref containing an object and want to avoid ` .value ` everywhere.
246-
247272## Common Pitfalls
248273
249274### Expecting template updates from registry methods
0 commit comments