toArray
Coerces any value — including null and undefined — to an array.
Usage
ts
import { toArray } from '@vuetify/v0'
const value = 'Example Value'
const valueAsArray = toArray(value)
console.log(valueAsArray) // ['Example Value']Architecture
toArray is a pure transformation utility:
Reactivity
toArray is a pure transformer function. It does not track reactivity or return reactive values.
Tip
Use inside computed for reactivity Wrap in computed() if you need reactive array normalization:
ts
const items = computed(() => toArray(props.items))Examples
Normalize Inputs
Shows toArray converting various input types — single values, arrays, null, undefined — to a consistent array output.
toArray() result
Input"hello"TypestringOutput["hello"]Length1
The following API details are for the toArray composable.
Functions
Was this page helpful?