npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@qababadr/prevue

v0.0.12

Published

Component preview tool for Vue 3

Readme

PreVue


✨ Features

  • ⚡ Lightweight Vue 3 component preview environment
  • 🧩 Preview components in isolation
  • 🔥 Full Vite HMR support
  • 🎨 Supports component scoped styles
  • 🛠 Zero configuration inside your main application
  • 📦 Works directly from npm

📦 Installation

Install PreVue using npm:

npm install @qababadr/prevue

or:

npm i @qababadr/prevue

🚀 Setup

1. Create a Preview Application Folder

Create a dedicated folder anywhere inside your project.

For example:

YourProject/
│
├── src/
│
├── AppPreviews/
│
└── package.json

The folder name is completely up to you.

Examples:

AppPreviews
ComponentPreview
VuePreview
Sandbox

2. Add a Vite Configuration

Inside your preview folder create:

AppPreviews/
│
├── vite.config.ts
├── main.ts
├── index.html
│
└── previews/

Example:

AppPreviews/vite.config.ts

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { prevue } from "@qababadr/prevue";

export default defineConfig({
  root: "AppPreviews",

  server: {
    hmr: {
      host: "localhost",
    },
  },

  plugins: [
    vue(),

    prevue({
      previewDir: "previews",
    }),
  ],
});

previewDir

The previewDir option points to the folder containing your preview components.

Example:

prevue({
  previewDir: "previews",
});

means PreVue will search:

AppPreviews/
└── previews/
    ├── Button.preview.vue
    ├── Card.preview.vue
    └── Input.preview.vue

You can rename this folder:

prevue({
  previewDir: "sandbox",
});

then:

AppPreviews/
└── sandbox/
    ├── Button.preview.vue

3. Create the Preview Entry Point

Create:

AppPreviews/main.ts

Add:

import previews from "virtual:prevue/previews";

import { createPrevue } from "@qababadr/prevue";

import "@qababadr/prevue/style.css";

createPrevue(previews).mount("#app");

4. Create the HTML Entry

Create:

AppPreviews/index.html

Content:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>Vue Component Previews</title>
  </head>

  <body>
    <div id="app"></div>

    <script type="module" src="./main.ts"></script>
  </body>
</html>

5. Add Your Preview Components

Create your preview components inside the folder defined by previewDir.

Example:

AppPreviews/

└── previews/

    ├── StyledCounterButton.preview.vue

    ├── UserCard.preview.vue

    └── LoginForm.preview.vue

A preview component is a normal Vue 3 Single File Component:

<script setup lang="ts">
import { ref } from "vue";

const count = ref(0);
</script>

<template>
  <button @click="count++">Clicks: {{ count }}</button>
</template>

<style scoped>
button {
  padding: 12px 20px;

  border-radius: 10px;

  background: #2563eb;

  color: white;
}
</style>

▶️ Run PreVue

Add a script in your package.json:

{
  "scripts": {
    "preview:components": "vite --config AppPreviews/vite.config.ts"
  }
}

Start the preview environment:

npm run preview:components

Your component preview application will start with Vite.


📁 Example Structure

A complete setup:

YourProject/

├── src/

├── AppPreviews/

│   ├── vite.config.ts

│   ├── main.ts

│   ├── index.html

│   │

│   └── previews/

│       ├── Button.preview.vue

│       ├── Card.preview.vue

│       └── Modal.preview.vue

│

├── package.json

└── node_modules/

🤝 Contributing

Contributions, issues, and feature requests are welcome.

Feel free to open an issue or submit a pull request.


📄 License

MIT © BADR QABA