Skip to content

Diff

The Diff component provides a visual comparison tool that allows users to slide a divider left and right to reveal the difference between two pieces of content displayed in the same area.

Since OrbitUI components are copied directly into your project, you’ll add the Diff component using the OrbitUI CLI:

Terminal window
npx orbitkit@latest add diff

Import the Diff and DiffItem components. The Diff component must contain exactly two DiffItem children.

Compares the same image with a visual filter applied to one of the sides (e.g., a blur effect).

The component can compare any block-level content, not just images (e.g., comparing background colors or styles on text elements).

The Diff component acts as the main container for the comparison tool. This component accepts all the standard HTML attributes that a <figure> element would.

The DiffItem component is the wrapper for the content on one side of the comparison. You must use exactly two DiffItem components inside Diff.

This component accepts all the standard HTML attributes that a <div> element would.