ValyroUI Русская версия

Image Compare

Before/after comparison: slider, side by side, overlay. Pro · Image generation › Results and editing

Before / after comparison: draggable split, side by side, or an opacity overlay.

Installation

npx valyro-cli@latest login
npx valyro-cli@latest add image-compare
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { ImageCompare } from 'valyro-ui-pro';

Props

PropTypeDefault
before *ImageCompareImageOriginal image: before the divider, first side by side, underneath in overlay.
after *ImageCompareImageResult image: after the divider, second side by side, faded over before in overlay. Its size sets the aspect ratio.
mode'slider' | 'side-by-side' | 'overlay'Controlled mode; use with onModeChange.
defaultMode'slider' | 'side-by-side' | 'overlay''slider'Initial mode when uncontrolled.
onModeChange(mode: ImageCompareMode) => voidCalled with the new mode when it changes.
positionnumberDivider position in percent from the start edge.
defaultPositionnumber50Initial position when uncontrolled.
onPositionChange(position: number) => voidCalled with the new position when it changes.
opacitynumberOpacity of "after" in overlay mode, 0–1.
defaultOpacitynumber0.5Initial opacity when uncontrolled.
onOpacityChange(opacity: number) => voidCalled with the new opacity when it changes.
showModesbooleantrueMode switch above the images. Default true.
localestringBCP 47 locale for numbers and dates; defaults to the ThemeProvider's, then the browser's.
labelsPartial<ImageCompareLabels>Overrides for the built-in English text; keys left out keep their defaults.

Related components

Previous: Image Result Grid · Next: Inpaint Canvas · All Image generation