Skip to main content

Image Comparer

shadow

The Image Comparer element is used to compare two images. It displays the images on top of each other and allows you to reveal the bottom image using the built-in slider.

Basic Usage

When to use

Use wje-img-comparer to improve readability, scannability, and contextual understanding of content.

When not to use

Do not replace structured interactive data with media-only presentation when precision is needed.

Accessibility

Provide alt text, maintain readable contrast, and include text equivalents for icon-only controls.

Best Practices

  • Compress media and use lazy loading in larger collections.
  • Keep information priority consistent across cards/lists.
  • Avoid duplicating the same meaning in icon and text without added value.

Attributes and Properties

No properties available for this component.

Events

No events available for this component.

Methods

No public methods available for this component.

CSS Shadow Parts

NameDescription
dividerThe divider part.

CSS Custom Properties

NameDescription
--wje-img-compare-divider-areaThe area of the divider. This is the size of the divider. Accepts any valid CSS size.
--wje-img-compare-divider-backgroundSets the background color of the divider in the image comparison component. Accepts any valid CSS color value (e.g., red, #ff0000, rgba(255, 255, 255, 0.5)). The default value is white, which ensures high contrast in most designs.
--wje-img-compare-divider-sizeThe size of the divider. This is the thickness of the divider. Accepts any valid CSS size.
--wje-img-compare-divider-leftThe left position of the divider. This is the initial position of the divider.
--wje-img-compare-positionThe position of the divider. This is the position of the divider.
--wje-img-compare-clip-pathThe clip path of the divider. This is the clip path of the divider.

Slots

NameDescription
beforeThe before image slot.
afterThe after image slot.