Command Palette

Search for a command to run...

GitHub
Blog
Next

Slide to Unlock

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

Loading...

Installation

pnpm dlx shadcn add @ncdai/slide-to-unlock

Usage

import {
  SlideToUnlock,
  SlideToUnlockHandle,
  SlideToUnlockText,
  SlideToUnlockTrack,
} from "@/components/slide-to-unlock";
 
import { ShimmeringText } from "@/registry/shimmering-text";
<SlideToUnlock>
  <SlideToUnlockTrack>
    <SlideToUnlockText>
      <ShimmeringText />
    </SlideToUnlockText>
    <SlideToUnlockHandle />
  </SlideToUnlockTrack>
</SlideToUnlock>

API Reference

SlideToUnlock

The root component that provides context for all child components.

PropTypeDefaultDescription
handleWidthnumber56Width of the draggable handle in pixels.
onUnlock() => voidCallback function triggered when the handle reaches the end.
classNamestringAdditional CSS classes to apply to the root element.

SlideToUnlockTrack

The container that holds the text and handle components.

PropTypeDescription
classNamestringAdditional CSS classes to apply to the track element.

SlideToUnlockText

The text label that fades out as the handle is dragged.

PropTypeDescription
childrenReactNode | (props: { isDragging: boolean }) => ReactNodeText content or render function that receives dragging state.
classNamestringAdditional CSS classes to apply to the text element.

SlideToUnlockHandle

The draggable handle element.

PropTypeDefaultDescription
childrenReactNodeArrowRightCustom icon or content to display inside the handle.
classNamestringAdditional CSS classes to apply to the handle element.

ShimmeringText

An animated text component that creates a shimmering effect by sequentially animating each character's color.

PropTypeDefaultDescription
textstringThe text content to display with the shimmering effect.
durationnumber1The duration (in seconds) for each character's shimmer animation cycle.
isStoppedbooleanfalseControls whether the animation is stopped. When true, characters return to their base color.
classNamestringAdditional CSS classes to apply to the root span element.

Examples

Default

Loading...

Custom Color

Loading...

Custom Handle

Loading...