Skip to main content

Vue Playground

Write Vue single-file components and see them live in a sandboxed preview, with a console, extra files and a zip download.

<script setup>
import { ref, computed } from 'vue';
import Greeting from './Greeting.vue';

const count = ref(0);
const doubled = computed(() => count.value * 2);
const fruits = ref(['Apple', 'Banana', 'Cherry']);
</script>

<template>
<main class="app">
<Greeting name="Vue" />
<button type="button" @click="count++">Clicked {{ count }} times (double: {{ doubled }})</button>
<ul>
<li v-for="fruit in fruits" :key="fruit">{{ fruit }}</li>
</ul>
</main>
</template>

<style scoped>
.app { font-family: system-ui, sans-serif; max-width: 28rem; margin: 2rem auto; padding: 1.5rem; background: #f8fafc; border-radius: 12px; }
button { padding: 0.4rem 0.9rem; font-size: 1rem; cursor: pointer; }
</style>

PreviewReady in 150 ms
Console

console.log messages, warnings and errors from your component appear here.

Shortcuts: Ctrl+Enter run · / search (use ⌘ on Mac)

Free Online Vue Playground

Try Vue components live. Write a single-file component in App.vue, and the preview shows it as you type, with a console for your messages, warnings and errors. Add more components, download the project as one zip, and nothing you write is uploaded. Use it to try a Vue idea, test a template or share a small component without creating a project or installing anything.

How to use the Vue playground

  1. Edit App.vue. It holds a <script setup> block, a <template> block and a <style> block, all in one file.
  2. Watch the preview update. Messages from console.log, Vue warnings and errors appear in the console under it.
  3. Press + to add a component such as Greeting.vue and use it with import Greeting from './Greeting.vue'.
  4. Use <style scoped> to keep a component's styles to itself. A plain .css file applies to the whole preview.
  5. Open the ⋯ menu and choose Download all files (.zip) to take the project with you.

What is and is not included

You get Vue 3 with the Composition API, ref, computed, watch, v-for, v-if, props and scoped styles. You can add packages from npm with Add packages (downloaded from esm.sh only when you press Add), and organise components in folders. For plain pages without a framework use the HTML/CSS/JS Playground, and to tidy markup try the HTML Beautifier.

Worked example

The sample is a counter, a list and a small child component. The top of App.vue:

<script setup>
import { ref, computed } from 'vue';
import Greeting from './Greeting.vue';

const count = ref(0);
const doubled = computed(() => count.value * 2);
const fruits = ref(['Apple', 'Banana', 'Cherry']);
</script>

<template>
  <main class="app">
    <Greeting name="Vue" />
    <button type="button" @click="count++">Clicked {{ count }} times (double: {{ doubled }})</button>
    <ul>
      <li v-for="fruit in fruits" :key="fruit">{{ fruit }}</li>
    </ul>
  </main>
</template>

<style scoped>

Result: a card with the heading Hello, Vue! (from Greeting.vue), a button that counts clicks and shows the doubled value, and a three-item fruit list.

Common mistakes

  • Leaving out the <template> block: the preview says what to add.
  • Forgetting .value on a ref inside the script (it is not needed in the template).
  • Importing a package before adding it: press Add packages first.
  • Writing :key on a v-for element without a unique value.

Frequently asked questions

Which version of Vue is this?
Vue 3, the production build, with single-file components, the Composition API, script setup and scoped styles. The version is fixed so a project behaves the same every time.
What is a single-file component?
A .vue file that holds a component in three blocks: a script block for the logic, a template block for the page and a style block for the look. The playground compiles it with Vue's own compiler.
Can I use TypeScript?
Yes: write <script setup lang="ts">. The types are removed before the code runs. They are not checked here, so a type mistake will not show an error.
How do I use another component?
Press + to add a file such as Greeting.vue, then import it in App.vue with import Greeting from './Greeting.vue' and use it as <Greeting /> in the template.
Can I import a package such as vue-router or pinia?
Yes. Press Add packages, type a name such as lodash or zustand@4, and press Add. The package is downloaded from esm.sh at that moment (your code is not sent, only the package name), pinned to the exact version, listed with its size, and saved with your project and its zip as package.json. Nothing is downloaded before you press Add. Packages that use Vue share the Vue of this page.
Is my code uploaded?
No. The components are compiled in your browser and shown in a sandboxed preview that has no network access unless you switch the internet option on.
Is this the same as the official Vue playground?
It is a smaller tool built for quick experiments: Vue 3 and your own files, run privately in your browser. It does not offer packages, a router or a hosted link.

Related tools

More Playground

View all Playground tools →