Tapas UI
Esc
  • IntroductionGetting startedWhat Tapas UI is and where to start.
  • InstallationGetting startedSet up shadcn/ui and add your first section.
  • CLI & AI agentsGetting startedThe shadcn CLI, the @tapas namespace, the MCP server and AI prompts.
  • TemplatesGetting startedWhole pages built from sections, installed with one command.
  • Demo sitesGetting startedThree fictional sites built only from Tapas sections.
  • ThemingCustomizationHow sections pick up your colors and radius.
  • ColorsCustomizationEvery CSS variable sections read, what it is for and where it is used.
  • Dark modeCustomizationSections follow your .dark variables.
  • MotionCustomizationPlain and motion versions, reduced motion and pause controls.
  • AccessibilityCustomizationWhat every section guarantees.
  • Waitlist formsGuidesPost signups to your own API route and store them.
  • Checkout linksGuidesPoint pricing buttons at Stripe payment links or any URL.
Menu
Browse the docs

DocsProduct story

Compare slider

Before and after, side by side and labelled; works without JavaScript.

Preview

Version
Preview theme color
More themes

The panels overlap and a divider reveals one or the other. Drag anywhere or use the keyboard. A flick carries on a little and settles with a spring, and the divider nudges once when it scrolls into view. Dragging takes the pointer, so keep links out of the panels. With reduced motion turned on, it renders the plain layout.

Wireframe
With your theme
Wireframe
With your theme

Installation

Run this in a project that already uses shadcn/ui. It adds the component and anything it needs; the motion version also adds the plain one and the motion package.

Usage

import { CompareSlider } from "@/components/custom/compare-slider";

<CompareSlider
  beforeLabel="Before"
  afterLabel="After"
  before={<img src={beforeUrl} alt="The old dashboard" />}
  after={<img src={afterUrl} alt="The new dashboard" />}
/>
import { CompareSliderMotion } from "@/components/custom/compare-slider/compare-slider-motion";

<CompareSliderMotion before={before} after={after} defaultPosition={40} />

Props

PropTypeDefaultDescription
before* (required)ReactNode–Left panel.
after* (required)ReactNode–Right panel. Give both the same size.
beforeLabelstring"Before"Chip on the before panel; also used in the accessible names.
afterLabelstring"After"Chip on the after panel.
...propsReact.ComponentProps<"div">–Any other div attribute (id, aria-*, data-*, ref) goes to the root element.
PropTypeDefaultDescription
before* (required)ReactNode–Left panel.
after* (required)ReactNode–Right panel. Give both the same size.
beforeLabelstring"Before"Chip on the before panel; also used in the accessible names.
afterLabelstring"After"Chip on the after panel.
...propsReact.ComponentProps<"div">–Any other div attribute (id, aria-*, data-*, ref) goes to the root element.
defaultPositionnumber50Where the divider starts, 0 to 100 from the left.

Accessibility

  • Plain shows both panels side by side as labelled figures, so nothing depends on JavaScript or dragging.
  • In the motion version the divider is a native range input: arrow keys, Page Up/Down, Home and End move it, and its value is announced as a share of each panel.
  • The motion version follows the visitor's reduced-motion setting and never hides content before it animates.