Skip to main content
You are viewing Pre-Alpha documentation.
Vuetify0 Logo
Theme
Mode
Accessibility
Vuetify
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

The toArray utility function provides a consistent way to convert any value into an array format. It handles edge cases like null and undefined values, and ensures that the output is always an array.


Intermediate100% coverageMar 3, 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))

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+/