Nuxt Component Viewer

Simple and fully dynamic single file alternative to Storyboard for Nuxt, accessable via /_components.

Demo: https://stackblitz.com/edit/nuxt-starter-uotxqv

Note: Experimental status.

screenshot-1

screenshot-2

Features

  • Component viewer
  • Localization (i18n)
  • 100% Tailwind
  • Fully dynamic
  • Quick toggles for component/viewport
  • Light/Dark mode
  • Single page

Setup

Prerequisites:

Minimal install guide

  1. Create new nuxt project

pnpm dlx nuxi@latest init nuxt-project
cd nuxt-project
  1. Install packages

pnpm install
pnpm add --save-dev @nuxtjs/tailwindcss
  1. add tailwind as module to nuxt.config.ts

export default defineNuxtConfig({
  devtools: { enabled: true },
  modules: [
    "@nuxtjs/tailwindcss",
  ],
})
  1. update .app to enable pages

<template>
  <div>
    <NuxtLayout>
      <NuxtPage  />
    </NuxtLayout>
  </div>
</template>
  1. create /pages folder

  2. create /pages/index.vue file with a link

<template>
    <div>
        <NuxtLink to="/_components/">Go to ComponentViewer</NuxtLink>
    </div>
</template>
  1. copy the _components.vue file from this repo to /pages/_components.vue

  2. create folder /layouts

  3. create files /layouts/default.vueand /layouts/blank.vue with this template

<template>
    <div>
      <slot />
    </div>
  </template>
  1. Create /components folder

  2. Create component file /components/ButtonComponent.vue

<template>
    <button class="bg-blue-400 p-4 py-2 text-white rounded-xl">A nice button</button>
</template>
  1. Start server
pnpm run dev
  1. Navigate to http://localhost:3000/_components

GitHub

View Github