toArray
Coerces any value — including null and undefined — to an array.
Edit this page
Edit documentation page
Report a Bug
Open Vuetify Issues
Open issues
View Issues on GitHub
View on GitHub
View source code on GitHub
Copy Markdown
Stable
Production-ready. Stable since 0.1.0
IntermediateIntermediate skill level — filter by level
Jun 29, 2026Last updated in: 758aff01
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
toArray() result
Input"hello"TypestringOutput["hello"]Length1
FAQ
An empty array ([]), not [null] or [undefined]. This makes it safe to iterate the result without a separate nullish check.
No. Existing arrays pass through unchanged; only non-array values are wrapped in a single-element array.
No — toArray is a pure synchronous transformer. Wrap it in toRef(() => toArray(prop)) or computed() when you need the normalized array to update reactively.
Discord
Need help? Join our community for support and discussions ↗
The following API details are for the toArray composable.
Was this page helpful?
Confusing
Unhelpful
Helpful
Amazing