Prompt
I'm building a shared UI kit and need to prevent visual regressions across multiple apps
Latest observation
Oct 27, 2026
OpenAI APIWeb search: off
A solid way to prevent visual regressions in a shared UI kit is to combine component-level visual tests with release discipline and clear versioning.
Recommended setup
1) Use Storybook as the source of truth
- Document every component state in Storybook:
- default
- hover / focus / active
- disabled
- error / success
- loading / empty states
- edge cases like long text, icons, RTL, dark mode
- Treat stories as your visual test fixtures.
2) Add visual regression testing
Use a screenshot diff tool against Storybook stories:
- Chromatic if you want the easiest Storybook-native option
- Alternatives: Percy, Playwright screenshots, Loki, Applitools
Typical flow:
- Render Storybook stories in CI
- Capture screenshots
- Compare against baselines
- Fail PRs when diffs exceed thresholds
- Review and approve intentional changes
3) Test across themes, browsers, and breakpoints
For a shared kit used by multiple apps, coverage should include:
- light/dark themes
- common viewport sizes
- major browsers
- localization if text length varies
- responsive variants if components adapt
4) Keep visual tests deterministic
Avoid flaky diffs by controlling:
- fonts
- network calls
- dates/timestamps
- random IDs
- animations/transitions
- async loading states
5) Version your UI kit carefully
- Use semver
- Document breaking visual changes
- Publish release notes with before/after screenshots when useful
- Encourage apps to pin compatible versions
6) Add consumer-app smoke checks
Because the kit is shared across multiple apps, also:
- run a small set of “integration” screenshots in each app or a representative shell app
- catch issues that only appear with app-specific layout, theming, or data
7) Establish a review workflow
- Visual diffs should be reviewed like code diffs
- Require approval for baseline updates
- Prefer a dedicated “design-system maintainers” reviewer group
Practical stack
A common, low-friction setup:
- React/Vue/etc. component library
- Storybook
- Chromatic for visual regression
- GitHub Actions / GitLab CI to run tests on PRs
- Changesets for versioning and changelogs
Good policy to adopt
- No component PR merges without passing visual checks
- Baseline changes must be explicitly approved
- Any new component must include stories for each important state
- Every release must be tested in at least one consumer app shell
If you want, I can also give you:
- a recommended CI pipeline,
- a tool comparison matrix, or
- a sample Storybook + Chromatic setup.