Custom previews

You can tell Preview.js to use preset properties for a specific component with a few lines of code:

import { setupPreviews } from "@previewjs/plugin-react/setup";

const MyComponent = ({ label }) => <div>{label}</div>;

setupPreviews(MyComponent, () => ({
  example: {
    label: "Hello, World!",
  },
}));

You can set up as many custom previews as you like. Preview.js will let you instantly switch between them.

See it in action