Skip to main content
Vuetify0 is now in alpha!
Vuetify0 Logo
Theme
Mode
Palettes
Accessibility
Vuetify One
Sign in to Vuetify One

Access premium tools across the Vuetify ecosystem — Bin, Play, Studio, and more.

Not a subscriber? See what's included

toArray

Coerces any value — including null and undefined — to an array.


IntermediateApr 5, 2026

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:

Array Transformation

Use controls to zoom and pan. Click outside or press Escape to close.

Array Transformation

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

API Reference

The following API details are for the toArray composable.

Functions

toArray

(value: Z | Z[]) => Z[]

Converts a value to an array.

Was this page helpful?

© 2016-1970 Vuetify, LLC
Ctrl+/