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

next-miguel

v0.1.7

Published

Miguel is a simple styleguide generator for NextJS.

Downloads

24

Readme

Publish to npm

Why Miguel?

Miguel is a simple styleguide generator for Next.js.

  • Uses Next.js pages directory to create a styleguide that is embedded in your application.
  • (Almost) no config required, components are always up to date with your live application.
  • It's simple, dead simple. A title, description and a component, that's it.
  • App context? Router dependencies? Something else? Still works.
  • Miguel is easy to integrate with your (external) design system.

No setbacks or frustrated keyboard smashing. If it works in your Next app, it works in Miguel.

Getting started

Installation

To get started, add Miguel to your project with yarn or npm.

yarn add next-miguel
npm install next-miguel

Adding Miguel to your build

Add Miguel to your next.config.js. See options below.

const withMiguel = require("next-miguel");

module.exports = withMiguel({
  miguel: {
    extension: ".example.js",  // Extension of your example files
    gitignore: true,  // Add styleguide to gitignore
    page: "miguel",  // Render page at 'pages/miguel.js'
    watchIgnore: [],  // Add files or directies that should not be watched
    watch: true, // Watch for changes files while developing
  },
});

And for production add it to your build step as well:

"build": "next-miguel && next build"

Creating your first example

To create a Miguel example create a file named: [componentname].example.js. Use the Example component included in Miguel to document your component.

import { Example } from "next-miguel/components";
import { Contact } from "./Contact";

export const ContactExample = ({ id }) => (
  <Example title="Contact" description="Here is my contact component" id={id}>
    <Contact
      title="Miguel"
      email="[email protected]"
      tel="+31612345678"
      whatsapp="+31612345678"
    />
  </Example>
);

Generate the Miguel styleguide

Run your local next server (next) and navigate to /miguel to see the result. By default, Miguel finds all *.examples.js files in your project and generates examples for them. The styleguide is created at /pages/miguel.js

Multiple Examples

To create multiple Miguel examples you can add multiple named exports to the same file. Use the Example component included in Miguel to document your component.

import { Example } from "next-miguel/components";
import { Contact } from "./Contact";

export const ContactExampleA = ({ id }) => (
  <Example title="Contact A" description="Here is my contact component in form A" id={id}>
    <Contact
      title="Miguel"
      email="[email protected]"
      tel="+31612345678"
      whatsapp="+31612345678"
    />
  </Example>
);

export const ContactExampleB = ({ id }) => (
  <Example title="Contact B" description="Here is my contact component in form B" id={id}>
    <Contact
      title="The brother of Miguel"
      email="[email protected]"
      tel="+31612345678"
      whatsapp="+31612345678"
    />
  </Example>
);

Including in other tools

The name of the export used in the Example component is mapped to a component that can be accessed by a query string. So the following example renders the component on /miguel?id=HelloWorld.

You can iframe this component in other tools like lasagna or zeroheight. When included in other source, the examples use iframe-resizer to make them responsive in iframes.

import { Example } from "next-miguel/components";

export const HelloWorld = () => (
  <Example title="Hello" description="world">
    <div>Hello world</div>
  </Example>
);

To add a link to the example on the miguel page add an id to the example component.

import { Example } from "next-miguel/components";

export const HelloWorld = ({ id }) => (
  <Example title="Hello" description="world" id={id}>
    <div>Hello world</div>
  </Example>
);

Options

Options are passed in the next config under the miguel key. When an option is ommited, the default value is used.

module.exports = withMiguel({
  ...
  miguel: {
    extension: ".example.js",
    page: "miguel",
  },
  ...
});

extension

The extension to look for. These files contain your examples that are generated in the styleguide. Defaults to .example.js.

miguel: {
  extension: '.example.js',
}

gitignore

Should the generated page automatically be added to the .gitignore? Defaults to true.

miguel: {
  ignore: true,
}

page

The page the styleguide is rendered to. This value is automatically created at /pages/[page].js so that next builds it as a page. Defaults to 'miguel'.

miguel: {
  page: 'miguel',
}

watch

Should miguel watch for file changes while developing? Defaults to true.

miguel: {
  watch: true,
}

watchIgnore

An array of directories (or files) to ignore in the watch function. This prevents a styleguide build when files change in that directory. Defaults to [].

miguel: {
  ignore: [],
}

The files or directories you add to the ignore are added to a list of default ignored directories. These do not have to be added to the ignore.

const defaultIgnore = [
  ".git",
  ".next",
  "*.DS_Store",
  "*.log",
  "bower_components",
  "node_modules",
  "out",
  "tmp",
];