Skip to main content
You are viewing Pre-Alpha documentation.
Vuetify0 Logo

useProxyModel

A composable for syncing refs bidirectionally with selection contexts, enabling seamless v-model integration with selection state.

Usage

The useProxyModel composable syncs an existing ref (like from defineModel()) with a selection context bidirectionally. Changes in either direction automatically propagate.

ts
import { ref } from 'vue'
import { createSelection, useProxyModel } from '@vuetify/v0'

const model = ref<string>()
const selection = createSelection({ events: true })

selection.onboard([
  { id: 'apple', value: 'Apple' },
  { id: 'banana', value: 'Banana' },
])

// Sync model with selection
const stop = useProxyModel(selection, model)

model.value = 'Apple'
console.log(selection.selectedIds) // Set { 'apple' }

selection.select('banana')
console.log(model.value) // 'Banana'

Architecture

useProxyModel creates bidirectional sync between v-model refs and selection state:

Diagram

Click outside or press Escape to close

API Reference

The following API details are for the useProxyModel composable.

Functions

useProxyModel

(registry: SelectionContext<Z>, model: Ref<unknown, unknown>, options?: ProxyModelOptions) => () => void

Syncs a ref with a selection registry bidirectionally.

Options

multiple

boolean

transformIn

(val: unknown) => unknown

transformOut

(val: unknown) => unknown

© 2016-2026 Vuetify, LLC
Ctrl+/