BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/ncdai/slide-to-unlock

Slide to Unlock

ncdai/slide-to-unlock
UnverifiedComponent

A sleek, interactive slider inspired by the classic iPhone OS 'slide to unlock' gesture.

Install it

npx shadcn@latest add https://raw.githubusercontent.com/Prathamesh-exe/prathfolio/main/chanhdai.com/public/r/slide-to-unlock.json

Source

src/registry/components/slide-to-unlock/slide-to-unlock.tsxraw.githubusercontent.com/Prathamesh-exe/prathfolio/main/chanhdai.com/public/r/slide-to-unlock.json
1"use client"
2
3import type { ComponentProps, ComponentPropsWithoutRef, JSX } from "react"
4import { createContext, useCallback, useContext, useRef, useState } from "react"
5import {
6 animate,
7 motion,
8 useMotionValue,
9 useTransform,
10 type MotionValue,
11} from "motion/react"
12
13import { cn } from "@/lib/utils"
14
15type SlideToUnlockContextValue = {
16 x: MotionValue<number>
17 trackRef: React.RefObject<HTMLDivElement | null>
18 isDragging: boolean
19 handleWidth: number
20 textOpacity: MotionValue<number>
21 onDragStart: () => void
22 onDragEnd: () => void
23}
24
25const SlideToUnlockContext = createContext<SlideToUnlockContextValue | null>(
26 null
27)
28
29function useSlideToUnlock() {
30 const context = useContext(SlideToUnlockContext)
31 if (!context) {
32 throw new Error(
33 `SlideToUnlock components must be used within SlideToUnlock`
34 )
35 }
36 return context
37}
38
39export type SlideToUnlockRootProps = ComponentProps<"div"> & {
40 /**
41 * Width of the drag handle in pixels.
42 * @defaultValue 56
43 * */
44 handleWidth?: number
45 /** Called when the handle is dragged fully to the end. */
46 onUnlock?: () => void
47}
48
49export function SlideToUnlock({
50 className,
51 handleWidth = 56,
52 children,
53 onUnlock,
54 ...props
55}: SlideToUnlockRootProps) {
56 const trackRef = useRef<HTMLDivElement>(null)
57 const [isDragging, setIsDragging] = useState(false)
58 const x = useMotionValue(0)
59
60 const fadeDistance = handleWidth
61 const textOpacity = useTransform(x, [0, fadeDistance], [1, 0])
62
63 const handleDragStart = useCallback(() => {
64 setIsDragging(true)
65 }, [])
66
67 const handleDragEnd = useCallback(() => {
68 setIsDragging(false)
69
70 const trackWidth = trackRef.current?.offsetWidth || 0
71 const maxX = trackWidth - handleWidth
72
73 if (x.get() >= maxX) {
74 onUnlock?.()
75 } else {
76 animate(x, 0, { type: "spring", bounce: 0, duration: 0.25 })
77 }
78 }, [x, onUnlock, handleWidth])
79
80 return (
81 <SlideToUnlockContext.Provider
82 value={{
83 x,
84 trackRef,
85 isDragging,
86 handleWidth,
87 textOpacity,
88 onDragStart: handleDragStart,
89 onDragEnd: handleDragEnd,
90 }}
91 >
92 <div
93 data-slot="slide-to-unlock"
94 className={cn(
95 "w-54 rounded-xl bg-muted p-1 shadow-inner inset-ring-1 inset-ring-foreground/10",
96 className
97 )}
98 {...props}
99 >
100 {children}
101 </div>
102 </SlideToUnlockContext.Provider>
103 )
104}
105
106export type SlideToUnlockTrackProps = ComponentProps<"div">
107
108// … truncated

What it pulls in

npm packages

  • motion

Other registry items

  • @ncdai/shimmering-text

Files it writes

  • src/registry/components/slide-to-unlock/slide-to-unlock.tsx

Facts

Registry
ncdai
Type
registry:component
Access
Unverified
Files written
1
Licence
the repository states none
In the index
at or before 2026-08-12
Last confirmed
today

Go to the source

chanhdai.com Prathamesh-exe/prathfolio on GitHub Raw registry item This item as JSON

More from ncdai

All 17 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Apple Hello Effectapple-hello-effectncdaiComponentsUnverified1 dep
Apple Hello Effect - Hindiapple-hello-effect-hindincdaiComponentsUnverified1 dep
Apple Hello Effect - Spanishapple-hello-effect-spanishncdaiComponentsUnverified1 dep
Apple Hello Effect - Vietnameseapple-hello-effect-vietnamesencdaiComponentsUnverified1 dep
Brand Assets Menubrand-assets-menuncdaiComponentsUnverified1 dep
chevrons-up-down-iconchevrons-up-down-iconncdaiComponentsUnverified1 dep
Code Block Commandcode-block-commandncdaiComponentsUnverified4 deps · 3 files
Consent Managerconsent-managerncdaiComponentsUnverified1 dep · 2 files

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