Configuration reference
These options control how Chromatic behaves via the CLI, config file and the GitHub Action. Refer to branching docs and diagnosing CLI issues for more context on when to use some of these flags.
Note that the config file only supports a subset of these options. Some options are exclusive to the CLI or the config file. The next section tags each option with the appropriate context.
Glob Types: Where supported, globs are handled via picomatch. To learn more about globs and how to use them, refer to our guide on globs. To verify your glob pattern, use the picomatch-playground.
Options
Auto accept changes
Flag:
--auto-accept-changes Option:
autoAcceptChangesType:
glob | booleanDefault:
falseExample:
"main" or trueBranch name
Flag:
--branch-name Option:
branchNameType:
stringDefault:
Example:
"my-branch"<owner>:<branch>Build command
Flag:
--build-command Option:
buildCommandType:
stringExample:
"nx run my-app:build-storybook"Requires
--output-dir.Build script name
Flag:
--build-script-name (-b)Option:
buildScriptNameType:
stringDefault:
build-storybookExample:
"build:storybook"CI
Flag:
--ci Type:
booleanDefault:
Example:
trueConfig file
Flag:
--config-file Option:
configFileType:
stringDefault:
chromatic.config.jsonExample:
"config/chromatic.json"Debug
Flag:
--debug Option:
debugType:
booleanDefault:
falseExample:
trueDiagnostics file
Flag:
--diagnostics-file Option:
diagnosticsFileType:
string | booleanDefault:
falseExample:
"debug.json" or trueDefaults to
chromatic-diagnostics.jsonDry run
Flag:
--dry-run Option:
dryRunType:
booleanDefault:
falseExample:
trueExit once uploaded
Flag:
--exit-once-uploaded Option:
exitOnceUploadedType:
glob | booleanDefault:
falseExample:
"my-branch" or true0 (OK) once the built version has been published to Chromatic. Only for given branch, if specified.Exit zero on changes
Flag:
--exit-zero-on-changes Option:
exitZeroOnChangesType:
glob | booleanDefault:
true in the GitHub Action, otherwise falseExample:
"!(main)" or true0 rather than the usual exit code 1. Only for given branch, if specified.Externals
Flag:
--externals Option:
externalsType:
string | string[] (glob)Example:
"my-folder/**"Requires
onlyChanged.Force rebuild
Flag:
--force-rebuild Option:
forceRebuildType:
glob | booleanDefault:
falseExample:
"my-branch" or trueGit timeout
Option:
gitTimeoutType:
numberDefault:
20Example:
30Ignore last build on branch
Flag:
--ignore-last-build-on-branch Option:
ignoreLastBuildOnBranchType:
globExample:
"my-branch"Interactive
Flag:
--no-interactive Option:
interactiveType:
booleanDefault:
Example:
falsetrue in non-TTY environments.JUnit report
Flag:
--junit-report Option:
junitReportType:
string | booleanDefault:
falseExample:
"report.xml" or trueDefaults to
chromatic-build-{buildNumber}.xml where the {buildNumber} will be replaced with the actual build number.List available stories
Flag:
--list Type:
booleanDefault:
falseExample:
trueUseful for debugging and diagnosing issues.
Log file
Flag:
--log-file Option:
logFileType:
string | booleanDefault:
falseExample:
"logs.txt" or truechromatic.logFile hashing
Flag:
--no-file-hashing Option:
fileHashingType:
booleanDefault:
falseExample:
trueOnly changed
Flag:
--only-changed Option:
onlyChangedType:
glob | booleanDefault:
falseExample:
trueRuns Chromatic for stories affected by files and dependencies that have changed since the baseline build, including the specified branch if provided.
Only story files
Flag:
--only-story-files Option:
onlyStoryFilesType:
string | string[] (glob)Example:
"src/ui/**"Only story names
Flag:
--only-story-names Option:
onlyStoryNamesType:
string | string[] (glob)Example:
"Atoms/Button/*"Output directory
Flag:
--output-dir (-o)Option:
outputDirType:
stringDefault:
Example:
"storybook-static"Patch build
Flag:
--patch-build Option:
patchBuildType:
stringExample:
"my-feature...main"Project ID
Option:
projectIdType:
stringExample:
"Project:5d67dc0374b2e300209c41e7"appId.Project token
Flag:
--project-token (-t)Option:
projectTokenType:
stringDefault:
Example:
"chpt_b2aef0123456789"CHROMATIC_PROJECT_TOKEN instead if you can.Repository slug
Flag:
--repository-slug Option:
repositorySlugType:
stringDefault:
Example:
"owner/repositoryName"Skip
Flag:
--skip Option:
skipType:
glob | booleanDefault:
falseExample:
"my-branch" or trueSkip update check
Flag:
--skip-update-check Option:
skipUpdateCheckType:
booleanDefault:
falseExample:
trueStorybook base directory
Flag:
--storybook-base-dir Option:
storybookBaseDirType:
stringExample:
"src/ui"Use with
onlyChanged and storybookBuildDir when your Storybook is located in a subdirectory of your repository.Storybook build directory
Flag:
--storybook-build-dir (-d)Option:
storybookBuildDirType:
stringExample:
"dist/storybook"Storybook config directory
Flag:
--storybook-config-dir Option:
storybookConfigDirType:
stringDefault:
.storybookExample:
"storybook-config"Use with
onlyChanged and storybookBuildDir when using a custom --config-dir flag for Storybook.Storybook log file
Flag:
--storybook-log-file Option:
storybookLogFileType:
string | booleanDefault:
build-storybook.logExample:
"sb.txt" or trueTrace changed
Flag:
--trace-changed Option:
traceChangedType:
string | booleanDefault:
falseExample:
"expanded" or trueRequires
onlyChanged.Working directory
Flag:
--working-dir Option:
workingDirType:
stringDefault:
process.cwd()Example:
"my-folder"package.json if installed in a subdirectory (i.e., monorepos). This is a GitHub Actions–specific key. Other CI/CD providers have their own flag.Untraced
Flag:
--untraced Option:
untracedType:
string | string[] (glob)Example:
"my-folder/**"Requires
onlyChanged.Upload metadata
Flag:
--upload-metadata Option:
uploadMetadataType:
booleanDefault:
falseExample:
truediagnosticsFile: true and logFile: trueZip
Flag:
--zip Option:
zipType:
booleanDefault:
falseExample:
truePlaywright
Flag:
--playwright Option:
playwrightType:
booleanDefault:
falseExample:
trueCypress
Flag:
--cypress Option:
cypressType:
booleanDefault:
falseExample:
trueVitest
Flag:
--vitest Option:
vitestType:
booleanDefault:
falseExample:
trueiOS build command
Option:
reactNative.iosBuildCommandType:
stringExample:
"nx run my-app:build-storybook-ios"Android build command
Option:
reactNative.androidBuildCommandType:
stringExample:
"nx run my-app:build-storybook-android"Android build architectures
Option:
reactNative.androidBuildArchitecturesType:
array of stringExample:
["arm64-v8a", "armeabi-v7a"]x86_64, if you would like additional architectures built you may specify them here.Incompatible option combinations
Some options are mutually exclusive or fundamentally incompatible. Using them together either produces unexpected results, causes one to silently override the other, or makes one of them entirely irrelevant.
| Options | Why they conflict |
|---|---|
onlyStoryNames or onlyStoryFiles with onlyChanged | TurboSnap (onlyChanged) is an automated filter: it uses your git history and dependency graph to decide which stories need to be tested. onlyStoryNames and onlyStoryFiles are manual filters: you explicitly tell Chromatic which stories or files to include, and Chromatic does not infer or validate those choices. |
onlyStoryNames and onlyStoryFiles | Both options filter what gets tested, but when used together only one gets applied. |
buildScriptName and storybookBuildDir | These options represent mutually exclusive approaches to providing a Storybook build to Chromatic: buildScriptName has Chromatic build your Storybook for you, whereas storybookBuildDir points at a build you’ve already made. |
autoAcceptChanges and exitZeroOnChanges | Both options prevent your CI pipeline from failing when visual changes are detected, but they do it differently: autoAcceptChanges automatically accepts all detected changes, while exitZeroOnChanges exits with a zero status code without accepting changes. |
skip and any other option | The skip option bypasses the Chromatic build entirely, which invalidates any option meant to tweak Chromatic’s build behavior. |
forceRebuild and onlyChanged | These options have directly opposing goals: TurboSnap (onlyChanged) is meant to skip stories that are unaffected by a change, while forceRebuild is meant to test them all. |
vitest, playwright, and cypress, | These are mutually exclusive execution modes. A build runs with Vitest, Playwright, or Cypress, never a combination of them. |
Environment variables
Some options can be configured through environment variables. You will typically only need these when instructed to. Flags take precedence over environment variables. Environment variables are also read from a .env file if present.
| Environment variable | Description |
|---|---|
CHROMATIC_PROJECT_TOKEN | Project token, see --project-token |
CHROMATIC_SHA | Git commit hash. See troubleshooting guide for issues |
CHROMATIC_BRANCH | Git branch name. See --branch-name for additional options and troubleshooting guide for issues |
CHROMATIC_SLUG | Git repository slug (e.g., chromaui/chromatic-cli). See troubleshooting guide for issues |
CHROMATIC_POLL_INTERVAL | Polling interval when waiting for the build to finish (default: 1000) |
CHROMATIC_OUTPUT_INTERVAL | Frequency of progress output while polling or uploading (default: 10000) |
CHROMATIC_RETRIES | Number of times to retry file upload (default: 5) |
CHROMATIC_STORYBOOK_VERSION | Overrides Storybook package/version detection (e.g. @storybook/react@7.0.1-alpha.25) |
CHROMATIC_TIMEOUT | Number of ms before giving up on storybook dev (default: 300000 (5 minutes)) |
STORYBOOK_BUILD_TIMEOUT | Number of ms before giving up on storybook build (default: 600000 (10 minutes)) |
CHROMATIC_DNS_SERVERS | Overrides the DNS server IP address(es) used by node-fetch, comma-separated. See troubleshooting guide for issues |
CHROMATIC_DNS_FAILOVER_SERVERS | Fallback DNS server IPs (default: 1.1.1.1, 8.8.8.8 (Cloudflare, Google)). See troubleshooting guide for issues |
CI | See --ci |
LOG_LEVEL | One of: silent, error, warn, info, debug |
DISABLE_LOGGING | Set to true to disable logging. Equal to LOG_LEVEL=silent |
HTTPS_PROXY or HTTP_PROXY | Used to configure https-proxy-agent. See troubleshooting guide for issues |
CHROMATIC_ARCHIVE_LOCATION | Change the default location for archives generated by Vitest, Playwright, or Cypress tests |
STORYBOOK_NODE_ENV | Specify a different environment for building Storybook in (default is production). Note that changing this value might slow down your builds or even alter the build behavior. |
MAX_LOCK_FILE_SIZE | Overrides default allowed lock file size (default: 10485760 (10 MB)). See troubleshooting guide for issues |
Deprecated options
The following options are still supported but will be removed in a future version. If your project still uses them, we encourage you to remove them from your scripts or configuration at your earliest convenience.
| CLI flag | |
|---|---|
--preserve-missing | Replaced by --only-* based options.Refer to the following documentation for more information on its deprecation and alternatives. |
Unsupported options
The options listed below are no longer supported by our CLI and will not yield any result if you provide them in your project. We recommend removing them from your scripts and configuration.
| CLI flag | |
|---|---|
--allow-console-errors | Continue running Chromatic even if Storybook logs errors in the console. |
--app-code <token> | Renamed to --project-token. |
--diagnostics | Replaced by --diagnostics-file. |
--do-not-start | Don’t attempt to start or build Storybook. Use this if your Storybook is already running, for example, when part of a larger app. Alias: -S |
--exec <command> | Alternatively, a shell command that starts your Storybook. Alias: -e |
--only | Replaced by --only-story-names. |
--preserve-missing-specs | Preserve missing stories when publishing a partial Storybook. |
--script-name [name] | The npm script that starts your Storybook. Defaults to storybook. Alias: -s |
--storybook-ca <ca> | Use with --storybook-https. Auto detected from the npm script when using --script-name. |
--storybook-cert <path> | Use with --storybook-https. Auto detected from the npm script when using --script-name. |
--storybook-https | Enable if Storybook runs on HTTPS (locally). Auto detected from the npm script when using --script-name. |
--storybook-key <path> | Use with --storybook-https. Auto detected from the npm script when using --script-name. |
--storybook-port <port> | What port is your Storybook running on. Auto detected from the npm script when using --script-name. Alias: -p |
--storybook-url <url> | Run against an online Storybook at some URL. This implies --do-not-start. Alias: -u |