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

strapi5-component-preview

v1.0.0

Published

A Strapi 5 plugin to preview dynamic zone components in real-time while editing pages

Downloads

89

Readme

Strapi Plugin: Component Preview

A Strapi 5 plugin that adds real-time component preview functionality to the Content Manager. Preview your dynamic zone components while editing pages with automatic demo data generation.

Component Preview

✨ Features

  • 🎨 Live Preview - See your components rendered in real-time
  • 🌙 Dark Mode Support - Automatically adapts to Strapi's theme
  • 📝 Demo Data Generation - Automatically fills empty fields with placeholder content
  • 🖼️ Placeholder Images - Generates placeholder images for media fields
  • 🔗 Schema-Aware - Reads component schemas to understand field types
  • 🪟 Inline & External Preview - Preview inline or open in new window
  • No Server API Required - Runs entirely client-side

📦 Installation

Using npm

npm install @pathi/strapi-plugin-component-preview

Using yarn

yarn add @pathi/strapi-plugin-component-preview

Manual Installation

Copy the plugin folder to your Strapi project:

cp -r strapi-plugin-component-preview ./src/plugins/component-preview

⚙️ Configuration

1. Enable the plugin

Add to your config/plugins.ts:

export default {
  'component-preview': {
    enabled: true,
  },
};

2. Create Frontend Preview Page

Create a preview page in your frontend application (Next.js example):

// app/preview/component/page.tsx
'use client';

import { useSearchParams } from 'next/navigation';
import { Suspense, useMemo } from 'react';
import { ComponentRenderer } from '@/components/ComponentRenderer';

function PreviewContent() {
  const searchParams = useSearchParams();
  
  const componentData = useMemo(() => {
    const data = searchParams.get('data');
    if (!data) return null;
    
    try {
      return JSON.parse(decodeURIComponent(atob(data)));
    } catch {
      return null;
    }
  }, [searchParams]);

  if (!componentData) {
    return <div>No component data</div>;
  }

  return <ComponentRenderer data={componentData} />;
}

export default function PreviewPage() {
  return (
    <Suspense fallback={<div>Loading...</div>}>
      <PreviewContent />
    </Suspense>
  );
}

🚀 Usage

  1. Open any Page (or content type with dynamic zones) in Strapi admin
  2. Look for the "Component Preview" panel in the right sidebar
  3. Toggle "Fill Empty Fields" to generate demo data
  4. Click on a component to preview inline
  5. Use the button to open in a new window

🎯 Demo Data Generation

The plugin intelligently generates demo data based on:

| Field Type | Generated Value | |------------|-----------------| | String fields | Field name (e.g., title"title") | | Media fields | Placeholder image with field name | | Component fields | Recursively generated from schema | | Repeatable components | 1 demo item | | Empty arrays | 1 demo item |

Media Placeholder

Media fields get placeholder images from placehold.co:

https://placehold.co/800x600/4945FF/FFFFFF?text=fieldName

🎨 Theme Support

The plugin automatically adapts to Strapi's theme:

  • Uses Strapi Design System tokens
  • Works with both light and dark mode
  • Consistent with Strapi's UI

📁 Project Structure

strapi-plugin-component-preview/
├── admin/
│   └── src/
│       ├── components/
│       │   ├── PreviewButton.tsx    # Main preview component
│       │   ├── PreviewPanel.tsx     # Preview panel wrapper
│       │   └── Initializer.tsx      # Plugin initializer
│       ├── pages/
│       │   ├── App.tsx
│       │   └── HomePage.tsx
│       ├── translations/
│       │   ├── en.json
│       │   └── tr.json
│       └── index.ts                 # Admin entry point
├── server/
│   └── src/
│       └── index.ts                 # Server entry point
├── frontend-examples/
│   ├── nextjs-app-router/
│   │   └── page.tsx
│   └── ComponentRenderer.tsx
├── package.json
└── README.md

🔧 Requirements

  • Strapi v5.0.0 or higher
  • Node.js 18+
  • A frontend application with a preview route

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

MIT License - see LICENSE for details.

🙏 Credits

Created by Pathi


Note: This plugin requires a frontend application to render the components. The plugin sends component data via URL parameters to your frontend preview page.

strapi-plugin-component-preview