storybranch

Compatibility

Chromatic compatibility

storybranch reads parameters.chromatic from the story context Storybook has already merged. Keys below are applied. Any other chromatic key is left unused, so a block copied from Chromatic keeps the behavior below and does not silently change it.

Supported keys

Parameter inheritance

Capture calls getStoryContext once per story. That context already follows Storybook’s merge: project parameters from .storybook/preview, then the meta (component) parameters, then the story. Objects deep-merge. Arrays, including ignoreSelectors andviewports, are replaced by the more specific value rather than concatenated.

// preview: chromatic.delay 0, ignoreSelectors [".from-preview"], diffThreshold 0.2
// meta:    chromatic.ignoreSelectors [".from-meta"], forcedColors "none"
// story:   chromatic.delay 15, media "print"
// result:  delay 15, diffThreshold 0.2, ignoreSelectors [".from-meta"],
//          forcedColors "none", media "print"

Ignored elements

Three marks exclude pixels from the diff. The screenshot you review still shows the real element.

storybranch finds those elements in the light DOM and in open shadow roots. A selector does not cross a shadow boundary. Elements inside an iframe are not searched; put the mark on the iframe element to exclude its box. Pixels inside the boxes are left out of the comparison. If an ignored element changes size or position and that moves other pixels, or the screenshot itself changes size, the diff still fails.

parameters: {
  chromatic: { ignoreSelectors: [".price"] },
}

Media features

forcedColors,prefersReducedMotion, andmedia are story parameters. They apply to every snapshot of that story, including each mode. Putting them inside a mode object does not emulate them. An invalid value fails the story (invalid chromatic.forcedColors,invalid chromatic.prefersReducedMotion,invalid chromatic.media, orinvalid chromatic.ignoreSelectors) instead of capturing the wrong variant.