component-vrt

Runs visual regression tests on individual components via Playwright gallery screenshots.

22|1|Updated Mar 30, 2026
One-click install
npx skills add https://github.com/mizchi/vlmkit --skill component-vrt-mizchi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: component-vrt
Source: https://github.com/mizchi/vlmkit/tree/main/.apm/skills/vlmkit/workflows/component-vrt
Command: npx skills add https://github.com/mizchi/vlmkit --skill component-vrt-mizchi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires playwright, and includes assets (resource) components.

What problem does it solve? Full-page visual diffs are too noisy when repairing a single component: the image is large, changes cascade across unrelated regions, and the component under repair is buried in unrelated pixels. This Skill narrows visual regression testing to one mounted component so the diff is small enough to read and act on. ## Core Features & Use Cases - Component-scoped screenshots: Mounts a story through a Playwright component-testing gallery (window.mount/window.unmount contract) and screenshots only that component via vlmkit check story, producing diffs up to 47x smaller than full-viewport shots. - Baseline → diff → fix loop: First run writes baselines, subsequent runs report story-drift with heatmaps and region geometry, and intended changes are approved with --update-baseline. - Copyable gallery templates: Ships ready-to-use gallery implementations for React, Vue, and vanilla JS (plus a host page and story template), since Playwright ships no gallery template. - Use Case: While restyling a Button component, run vlmkit check story components/Button/Primary --gallery <url> after each edit, read the heatmap regions, fix, and re-run until the story reports unchanged. ## Quick Start Ask the agent to set up a component gallery from the bundled templates and run component-level visual regression on a specific story until the diff is clean.

Frequently Asked Questions about component-vrt

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run visual regression tests on a single component?

Use vlmkit check story with a gallery URL to mount one story and screenshot only that component. The first run writes a baseline; later runs report story-drift with a heatmap and region list, and intended changes are approved with --update-baseline.

What is a Playwright component-testing gallery and how do I create one?

A gallery is one page exposing window.mount({ story, props }) and window.unmount() that renders into #root. Playwright ships no template, so copy the bundled React, Vue, or vanilla gallery templates and adjust the import.meta.glob to your story layout.

Component VRT vs full-page visual diff: which should I use?

Use component VRT when repairing or restyling one component, since diffs are up to 47x smaller and unaffected by unrelated page changes. Keep a page-level diff html in the suite too, because story diffs miss sub-perceptual style drift that computed-style comparison catches.

Does vlmkit check story work with Storybook?

Storybook is not drop-in compatible: its iframe renders from a URL query param and exposes no window.mount, so check story reports mount-failed. A shim in .storybook/preview.js could bridge it, but that path is unverified.

Why does check story report mount-failed?

Mount-failed means nothing was measured: the story id is unknown, the render threw, or the page is not a gallery. Fix the id or gallery rather than disabling the rule, since suppressing it makes a typo'd story id read as a passing component.

What are the limitations of component-level screenshot comparison?

Large components with the default 0.5% threshold can miss small seeded changes, and sub-perceptual palette shifts under the comparator's per-channel floor pass as unchanged. Derive a per-story threshold for components over ~50,000px and keep a page-level diff html for computed-style drift.