Getting startedComponentsDesign tokensThemingTheme synthesizerFrameworksAccessibilityUtilitiesServer renderingBrowser supportContributingChangelogApp ShellAspect GridAuth ShellCenterContainerDashboard GridFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbarAnchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkMenubarNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkStepper NavTabsTop BarTree ViewAccordionAspect RatioAvatarAvatar GroupCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageImage CompareImage HotspotsInfinite ScrollLightboxMarqueeQR CodeScroll AreaSkeletonSpinnerStackVideoVirtual ListActivity HeatmapAnimated NumberBadgeBar ListChartClockComparisonCountdown TimerData GridDescription ListDiffGaugeJSON TreeKanbanLevel MeterListMeterSparklineStatStepperTagTimelineUptimeValue CardWaveformBlockquoteCode BlockCode GroupGradient TextHighlightKbdKeyboard MapMarkdownNumber FormatProseTerminalTextTime AgoTruncateTypewriterButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerDate Range PickerField ListFieldsetFile UploadFormHotkeyIcon ButtonImage CropperInline EditInputInput GroupKnobLabelMasked InputMulti SelectNumber InputPassword InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSignature PadSliderSortable ListSwitch GroupTag InputTextareaTheme ToggleTime PickerToggleTransfer ListTree SelectAlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuConversationDialogDropdown MenuHover CardLoading OverlayNotification PanelPopoverProgressSheetToastTooltip
ARC UIARC Radiant Components
v4.9DocsComponentsTokensSynthesizer
Getting startedFrameworksServer renderingDesign tokensThemingTheme synthesizerTypographyUtilitiesAll componentsAccessibilityBrowser supportChangelogContributingStatsApp ShellAspect GridAuth ShellCenterContainerDashboard GridFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbarAnchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkMenubarNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkStepper NavTabsTop BarTree ViewAccordionAspect RatioAvatarAvatar GroupCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageImage CompareImage HotspotsInfinite ScrollLightboxMarqueeQR CodeScroll AreaSkeletonSpinnerStackVideoVirtual ListActivity HeatmapAnimated NumberBadgeBar ListChartClockComparisonCountdown TimerData GridDescription ListDiffGaugeJSON TreeKanbanLevel MeterListMeterSparklineStatStepperTagTimelineUptimeValue CardWaveformBlockquoteCode BlockCode GroupGradient TextHighlightKbdKeyboard MapMarkdownNumber FormatProseTerminalTextTime AgoTruncateTypewriterButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerDate Range PickerField ListFieldsetFile UploadFormHotkeyIcon ButtonImage CropperInline EditInputInput GroupKnobLabelMasked InputMulti SelectNumber InputPassword InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSignature PadSliderSortable ListSwitch GroupTag InputTextareaTheme ToggleTime PickerToggleTransfer ListTree SelectAlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuConversationDialogDropdown MenuHover CardLoading OverlayNotification PanelPopoverProgressSheetToastTooltip

Image Compare

Before-and-after comparison: two stacked images and a divider you drag to reveal one over the other.

ComponentsImage Compare
contentinteractive
<arc-image-compare>

Overview

Image Compare stacks two images and shows the `before` slot over the `after` slot up to a divider you drag. The reveal is a CSS clip driven by `position` (0 to 100, default 50), so the component server-renders at its starting position and never measures the images. Both slots take a plain `<img>` or an `arc-image`. The two images need the same aspect ratio, because the top layer is cropped to cover the frame. The divider's round handle is also the keyboard control: a focusable `role="slider"` that moves by 1 with the arrow keys, by 10 with Shift, and to either end with Home and End. Dragging fires `arc-input` on every move and `arc-change` once on release. `orientation` names the axis the divider moves along: `horizontal` (the default) slides a vertical line left and right, and `vertical` slides a horizontal line up and down. Position 0 is the inline-start edge, so the control mirrors in right-to-left documents.

Guidelines

Do

  • Use two images of the same subject at the same aspect ratio
  • Set `before-label` and `after-label` when the images don't make the direction of the edit obvious
  • Give the handle a `label` that says what's being compared, for screen readers
  • Use `arc-input` for cheap live readouts and `arc-change` for anything expensive or saved

Don't

  • Don't use it for unrelated images. Use Carousel
  • Don't compare text or code revisions with it. A rendered diff shows those changes exactly
  • Don't start `position` near 0 or 100. With one image almost hidden, people won't see there's anything to drag

Features

  • A drag can start anywhere on the frame
  • `before-label` and `after-label` add caption chips in the corners of each image

Preview

River valley before color grading River valley after color grading

Usage

Image Compare is in the marketing group, so the default @arclux/arc-ui entry point doesn't include it. Import it from@arclux/arc-ui/marketing or from its own subpath,@arclux/arc-ui/image-compare.

This component needs JavaScript. Use the Web Component or a framework wrapper.

<arc-image-compare
  label="Color grade comparison"
  before-label="Original"
  after-label="Graded"
  position="50"
>
  <img slot="before" src="/photos/valley-raw.jpg" alt="River valley, unedited" />
  <img slot="after" src="/photos/valley-graded.jpg" alt="River valley, color graded" />
</arc-image-compare>

<!-- Vertical divider motion -->
<arc-image-compare orientation="vertical" label="Sky replacement">
  <img slot="before" src="/photos/sky-raw.jpg" alt="Original sky" />
  <img slot="after" src="/photos/sky-replaced.jpg" alt="Replaced sky" />
</arc-image-compare>

API

before-labelstring''
Optional caption for the before layer, rendered as a floating chip in the start corner.
after-labelstring''
Optional caption for the after layer, rendered as a floating chip in the end corner.
labelstring''
Accessible name for the divider handle, announced as the slider label.
positionnumber50
Divider position as a percentage, 0 to 100. 0 shows only the after layer, 100 only the before layer. Clamped, reflected, and updated as the user drags.
orientation'horizontal' | 'vertical''horizontal'
Axis the divider moves along. horizontal (default) moves a vertical divider line left-right; vertical moves a horizontal line up-down.

Events

arc-inputdetail:{ value: number }
Fired continuously while dragging (every pointer move) and on each keyboard nudge. value is the position, 0-100. Use for live readouts.
arc-changedetail:{ value: number }
Fired once when the position commits: on pointer release, or with each keyboard nudge. Use for persisting the position.

See also