BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/atroui/before-after-slider

Before / After

atroui/before-after-slider
FreeBlock

Compare wireframe vs shipped UI mockups.

Install it

npx shadcn@latest add https://atroui.com/r/before-after-slider.json

Source

registry/default/blocks/before-after-slider.tsxatroui.com/r/before-after-slider.json
1"use client";
2
3import { useCallback, useRef, useState } from "react";
4
5import { UiMockupFrame, type MockupVariant } from "../ui/mockup-frame";
6import { cn } from "@/lib/utils";
7
8type BeforeAfterSliderProps = {
9 variant?: MockupVariant;
10 beforeLabel?: string;
11 afterLabel?: string;
12 className?: string;
13};
14
15export function BeforeAfterSlider({
16 variant = "saas",
17 beforeLabel = "Before",
18 afterLabel = "After",
19 className,
20}: BeforeAfterSliderProps) {
21 const [position, setPosition] = useState(50);
22 const containerRef = useRef<HTMLDivElement>(null);
23 const dragging = useRef(false);
24
25 const updatePosition = useCallback((clientX: number) => {
26 const el = containerRef.current;
27 if (!el) return;
28 const rect = el.getBoundingClientRect();
29 const pct = Math.min(100, Math.max(0, ((clientX - rect.left) / rect.width) * 100));
30 setPosition(pct);
31 }, []);
32
33 const onPointerDown = (e: React.PointerEvent) => {
34 dragging.current = true;
35 (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);
36 updatePosition(e.clientX);
37 };
38
39 const onPointerMove = (e: React.PointerEvent) => {
40 if (!dragging.current) return;
41 updatePosition(e.clientX);
42 };
43
44 const onPointerUp = () => {
45 dragging.current = false;
46 };
47
48 const onKeyDown = (e: React.KeyboardEvent) => {
49 if (e.key === "ArrowLeft") setPosition((p) => Math.max(0, p - 5));
50 if (e.key === "ArrowRight") setPosition((p) => Math.min(100, p + 5));
51 };
52
53 return (
54 <div
55 ref={containerRef}
56 className={cn(
57 "relative aspect-[16/9] overflow-hidden rounded-2xl border border-border-subtle bg-muted p-3 sm:p-4 select-none touch-none",
58 className
59 )}
60 onPointerMove={onPointerMove}
61 onPointerUp={onPointerUp}
62 onPointerLeave={onPointerUp}
63 >
64 <div className="absolute inset-3 sm:inset-4" aria-hidden>
65 <UiMockupFrame variant={variant} state="shipped" label={`${afterLabel} UI state`} className="h-full" />
66 </div>
67
68 <div
69 className="absolute inset-3 sm:inset-4 overflow-hidden rounded-lg"
70 style={{ clipPath: `inset(0 ${100 - position}% 0 0)` }}
71 aria-hidden
72 >
73 <UiMockupFrame variant={variant} state="wireframe" label={`${beforeLabel} UI state`} className="h-full" />
74 </div>
75
76 <div
77 className="absolute top-3 bottom-3 z-10 w-1 cursor-ew-resize bg-white shadow-lg sm:top-4 sm:bottom-4"
78// … truncated

What it pulls in

Other registry items

  • @atroui/utils
  • @atroui/mockup-frame

Files it writes

  • registry/default/blocks/before-after-slider.tsx

Facts

Registry
atroui
Type
registry:block
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-12
Last confirmed
today

Go to the source

atroui.com atroui/atroui on GitHub Raw registry item This item as JSON

More from atroui

All 82 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Analytics Provideranalytics-provideratrouiBlocksFree1 dep
AR Portfolioar-portfolioatrouiBlocksFree1 dep
Calendly Embedcalendly-embedatrouiBlocksFree1 dep
ChangelogchangelogatrouiBlocksFreeno deps
Command Menucommand-menuatrouiBlocksFree4 deps
Contact Formcontact-formatrouiBlocksFree2 deps
Contextual CTAcontextual-ctaatrouiBlocksFree2 deps
Count Upcount-upatrouiBlocksFreeno deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex