UI Inspect
Getting Started

Configuration

Configure UI Inspect projects, screenshots, thresholds, and TurboSnap.

Configuration file

UI Inspect uses a YAML configuration file at the root of your project. Create one with npx ui-inspect init or manually:

ui-inspect.config.yml
# Required: Your project ID from the dashboard
projectId: "uuid-from-dashboard"

# Base URL for screenshot capture (default: http://localhost:3000)
baseUrl: "http://localhost:3000"

# API URL (default: https://app.uiinspect.dev)
apiUrl: "https://app.uiinspect.dev"

# Pixel diff threshold (0-1, default: 0.1)
# Lower values are stricter. 0 = exact match, 1 = allow everything
threshold: 0.1

# Exit with code 1 if diffs exceed threshold (default: true)
failOnDiff: true

# Auto-approve screenshots that have no existing baseline (default: false)
autoApprove: false

# Directory for storing captured screenshots
screenshotDir: ".ui-inspect/screenshots"

# Screenshot definitions
screenshots:
  - name: "homepage"
    url: "/"
    viewports:
      - name: "desktop"
        width: 1440
        height: 900
      - name: "tablet"
        width: 768
        height: 1024
      - name: "mobile"
        width: 375
        height: 812

  - name: "login"
    url: "/login"
    viewports:
      - name: "desktop"
        width: 1440
        height: 1080

# TurboSnap configuration
turboSnap:
  enabled: true
  baseBranch: "main"
  # Files that trigger full re-test when changed
  globalDeps:
    - "src/styles/**"
    - "tailwind.config.*"
    - "package.json"
  # Include untracked files in analysis
  includeUntracked: false

Screenshot configuration

Each screenshot entry defines a page to capture:

FieldTypeRequiredDescription
namestringYesUnique identifier for this screenshot
urlstringYesPath relative to baseUrl
viewportsarrayYesList of viewport sizes
viewports[].namestringYesViewport label (e.g., "desktop")
viewports[].widthnumberYesViewport width in pixels
viewports[].heightnumberYesViewport height in pixels

Threshold tuning

The threshold value controls how sensitive the diff detection is:

ValueSensitivityUse case
0Exact matchPixel-perfect designs, static pages
0.05Very strictDesign system components
0.1RecommendedGeneral visual regression
0.2LenientPages with dynamic content
0.5Very lenientRough layout checks only

The smart diff engine also applies anti-flake filtering and SSIM analysis on top of the pixel threshold, so even at strict thresholds, anti-aliasing noise won't cause false positives.

Environment variables

These override config file values:

VariableDescription
UI_INSPECT_TOKENAPI authentication token (required)
UI_INSPECT_API_URLOverride API server URL
UI_INSPECT_PROJECT_IDOverride project ID

CI provider detection

The CLI auto-detects your CI environment and extracts branch/commit info:

ProviderDetected via
GitHub ActionsGITHUB_ACTIONS
GitLab CIGITLAB_CI
CircleCICIRCLECI
BuildkiteBUILDKITE
Travis CITRAVIS

You can always override with --branch and --commit flags.

On this page