BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/loomui/compare-slider

Compare Slider

loomui/compare-slider
FreeComponent

Two versions of the same frame, split by a divider you drag, or move with the arrow keys.

Live preview

live · rendered by the registry
Rendered by loomui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://loomui.design/r/compare-slider.json

Source

registry/loomui/compare-slider.tsxloomui.design/r/compare-slider.json
1"use client"
2
3import * as React from "react"
4
5import { cn } from "@/lib/utils"
6
7export interface CompareSliderProps extends Omit<
8 React.ComponentProps<"div">,
9 "onChange"
10> {
11 /** Sits in flow and sets the size of the frame. Shown before the divider. */
12 before: React.ReactNode
13 /** Laid over the top and clipped to after the divider. */
14 after: React.ReactNode
15 /** Divider position, 0 to 100. Leave it out to let the slider own it. */
16 position?: number
17 /** Starting position when the slider owns it. */
18 defaultPosition?: number
19 /** Called with the position the divider moved to. */
20 onPositionChange?: (position: number) => void
21 /** Split left to right, or top to bottom. */
22 orientation?: "horizontal" | "vertical"
23 /** Percent moved per arrow key. Shift moves five of these. */
24 step?: number
25 /** Name for the divider, which is a real slider. */
26 label?: string
27}
28
29const clamp = (value: number) => Math.min(Math.max(value, 0), 100)
30
31export function CompareSlider({
32 before,
33 after,
34 position,
35 defaultPosition = 50,
36 onPositionChange,
37 orientation = "horizontal",
38 step = 2,
39 label = "Compare",
40 className,
41 style,
42 ...props
43}: CompareSliderProps) {
44 const [own, setOwn] = React.useState(defaultPosition)
45 const [dragging, setDragging] = React.useState(false)
46 const frameRef = React.useRef<HTMLDivElement>(null)
47
48 const isControlled = position !== undefined
49 const value = clamp(isControlled ? position : own)
50 const vertical = orientation === "vertical"
51
52 const commit = (next: number) => {
53 const clamped = clamp(next)
54 if (!isControlled) {
55 setOwn(clamped)
56 }
57 onPositionChange?.(clamped)
58 }
59
60 const trackPointer = (event: React.PointerEvent<HTMLDivElement>) => {
61 const frame = frameRef.current
62 if (!frame) {
63 return
64 }
65 const rect = frame.getBoundingClientRect()
66 const ratio = vertical
67 ? (event.clientY - rect.top) / rect.height
68 : (event.clientX - rect.left) / rect.width
69 commit(ratio * 100)
70 }
71
72 const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
73 const distance = event.shiftKey ? step * 5 : step
74 const back = vertical ? "ArrowUp" : "ArrowLeft"
75 const forward = vertical ? "ArrowDown" : "ArrowRight"
76
77 if (event.key === back) {
78 commit(value - distance)
79 } else if (event.key === forward) {
80 commit(value + distance)
81 } else if (event.key === "Home") {
82 commit(0)
83 } else if (event.key === "End") {
84 commit(100)
85// … truncated

What it pulls in

Other registry items

  • utils

Files it writes

  • registry/loomui/compare-slider.tsx

Facts

Registry
loomui
Type
registry:ui
Access
Free
Files written
1
Theme wiring
ships cssVars
Licence
MIT
In the index
at or before 2026-08-20
Last confirmed
yesterday

Go to the source

Docs on loomui loomui.design rjcuff/Loom-UI on GitHub Raw registry item This item as JSON

More from loomui

All 91 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Aurora Backdropaurora-backdroploomuiComponentsFreeno deps
Bento Gridbento-gridloomuiComponentsFreeno deps
Card Stackcard-stackloomuiComponentsFreeno deps
Confetti Buttonconfetti-buttonloomuiComponentsFreeno deps
Count Upcount-uploomuiComponentsFreeno deps
Credit Cardcredit-cardloomuiComponentsFreeno deps
DrawerdrawerloomuiComponentsFree1 dep
Elastic Tabselastic-tabsloomuiComponentsFreeno 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

KitGrade

SaaS starter kits, scored on what can be checked

kitgrade.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 KitGrade

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 KitGrade

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 KitGrade

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