Skip to content

243 React components with motion, keyboard support and a reduced-motion fallback. Copy the source or install with the shadcn CLI.

  1. 01 / 06Card WalletPhysical Surfaces & Navigation
  2. 02 / 06Ring Reel3D Galleries & Carousels
  3. 03 / 06Token Swap WidgetWeb3: DeFi & Trading
  4. 04 / 06Clothesline CardsStudio Pieces & Glyph Art
  5. 05 / 06Glyph Map CardStudio Pieces & Glyph Art
  6. 06 / 06Wallet Agent ChatUsage, Billing & Agent Commerce

Find yours.

22 categories, from buttons to WebGL backgrounds. Hover one to see its first component.

Anatomy of a component.

Every component ships with keyboard support, a visible focus ring, a reduced-motion fallback and tokens that follow your theme. Flip the switches and watch this one change.

Press and hold for 1.5 seconds to confirm.

Press and hold, or hold Space

Files

  • components/ui/hold-to-confirm-button/
  • hold-to-confirm-button.tsx
  • demo.tsx
  • docs.ts
hold-to-confirm-button.tsx232 lines
"use client";

import { useEffect, useId, useRef, useState, type ComponentProps, type ReactNode } from "react";
import {
  AnimatePresence,
  animate,
  motion,
  useMotionValue,
  useReducedMotion,
  useTransform,
  type AnimationPlaybackControls,
} from "motion/react";
import { Check } from "lucide-react";
import { cn } from "@/lib/utils";
import { duration as durations, ease, spring } from "@/lib/motion";

export interface HoldToConfirmButtonProps
  extends Omit<ComponentProps<"button">, "onAnimationStart" | "onDrag" | "onDragStart" | "onDragEnd"> {
  /** Called once the hold completes. */
  onConfirm?: () => void;
  /** Milliseconds the button must be held. @default 1500 */
  duration?: number;
  /** Label shown after confirming. @default "Confirmed" */
  confirmedLabel?: ReactNode;
  /** Milliseconds before resetting after a confirm. 0 keeps it confirmed. @default 2000 */
  resetAfter?: number;
Read the whole component

Install it.

With the shadcn CLI

One command adds the component, its dependencies and the shared helpers to your project.

npx shadcn@latest add https://hantui-theta.vercel.app/r/hold-to-confirm-button.json

By copying the source

  1. Open a component and switch to its Code tab.
  2. Copy the file into components/ui in your project.
  3. Install the packages listed under Manual on the same page.
Installation guide

What's new.