Command Palette

Search for a command to run...

GitHub
Components
Next

Slide to Unlock

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

Loading...

Installation

pnpm dlx ncdai add slide-to-unlock

Usage

import {
  SlideToUnlock,
  SlideToUnlockHandle,
  SlideToUnlockText,
  SlideToUnlockTrack,
} from "@/components/slide-to-unlock";
<SlideToUnlock>
  <SlideToUnlockTrack>
    <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.

PropTypeDefaultDescription
classNamestringAdditional CSS classes to apply to the track element.

SlideToUnlockText

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

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

SlideToUnlockHandle

The draggable handle element.

PropTypeDefaultDescription
childrenReactNodeArrow iconCustom icon or content to display inside the handle.
classNamestringAdditional CSS classes to apply to the handle element.
styleReact.CSSPropertiesInline styles to apply to the handle element.

Examples

Default

Loading...

Custom Color

Loading...

Custom Handle

Loading...