vue-frag

vue-frag

Use Vue 3's Fragment Feature in Vue 2


Description

Using Vue 3’s Fragment Feature in Vue 2

Overview

vue-frag enables you to create fragments—components with multiple root elements—in Vue 2.

When to Use It

Apply this approach when the component’s single root element adds no value, becomes unnecessary, or distorts your HTML output. This scenario commonly arises when you need to return a list of elements such as:

  • <li>List Items</li>
  • <tr><td>Table Rows</td></tr>

but would otherwise have to wrap them in an extra <div>.

How It Works

The plugin tricks Vue.js into believing that the root element remains in the DOM, even though it is not actually present.


Creator

Hiroki Osame
@privatenumbr

Related Projects

Markstream

AI-powered Streaming Markdown Renderer

Vue 3 JSON Editor

Vue 3 JSON Editor

JSON Editor Component

Vuelor

Vuelor

Colorpicker Component

Roughness

Roughness

Hand-drawn Component Library

Stk Table Vue

Stk Table Vue

Virtual List Component