A before and after image. Drag the handle in the middle to move the divider.
Unlock it plus 108 pro blocks, widgets & layouts — $99 one-time. Lifetime updates, 14-day money-back guarantee.

Blue hourGolden hour<ply-image-compare [beforeSrc]="before" [afterSrc]="after" beforeAlt="Cliff house at blue hour" afterAlt="Cliff house at golden hour" beforeLabel="Blue hour" afterLabel="Golden hour"> </ply-image-compare>
TypeScript
import { Component } from '@angular/core';
// Install: npx ply-ui-cli add image-compare
// Paths are relative to aliases.components (default: src/app/components)
import { ImageCompareComponent } from './image-compare/image-compare.component';
@Component({
selector: 'app-image-compare-example',
imports: [
ImageCompareComponent
],
template: `...`
})
export class ImageCompareExampleComponent {
readonly before = '/assets/image-compare/blue-hour.jpg';
readonly after = '/assets/image-compare/golden-hour.jpg';
}Install
npx ply-ui-cli add image-compare
npx ply-ui-cli add image-compare
For AI agents
Copy a prompt with the registry name, CLI install, and import — or add the Ply MCP server.
npx -y ply-ui-mcp
Ply provides standalone components. Import the exact elements you want to use into your component.
// Install: npx ply-ui-cli add image-compare
// Paths are relative to aliases.components (default: src/app/components)
import { ImageCompareComponent } from './image-compare/image-compare.component';
@Component({
selector: 'app-your-component',
imports: [
ImageCompareComponent
],
template: `...`
})
export class YourComponent {} API for image-compare — generated from JSDoc in the library source.
| API | Member | Type | Default | Description |
|---|---|---|---|---|
ply-image-compare | class | string | '' | Extra host classes merged via `cn()`. |
ply-image-compare | beforeSrc | string | '' | Image shown on the leading side of the divider. |
ply-image-compare | afterSrc | string | '' | Image shown behind the divider. |
ply-image-compare | beforeAlt | unknown | 'Before' | Alt text for the leading image. |
ply-image-compare | afterAlt | unknown | 'After' | Alt text for the trailing image. |
ply-image-compare | beforeLabel | unknown | 'Before' | Caption for the leading side. |
ply-image-compare | afterLabel | unknown | 'After' | Caption for the trailing side. |
ply-image-compare | aria-label | unknown | 'Comparison' | Accessible name of the divider handle. |
ply-image-compare | position | number | 50 | Divider position from 0 to 100. Two-way bindable. |
Content