Özer

Long Press Button

Buttons 17

About

A press-and-hold confirmation button with animated fill progress and a matching useLongPress hook for building your own hold-to-confirm interactions.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Long Press Button to your project and fits it to your theme.

Code

How Long Press Button is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import * as React from "react";
import { LongPressButton } from "@/components/ui/long-press";

export default function LongPressDemo() {
  const [archived, setArchived] = React.useState(false);

  return (
    <div className="flex min-h-[280px] w-full flex-col items-center justify-center gap-4">
      <div className="flex items-center gap-3">
        <LongPressButton onLongPress={() => setArchived(true)}>
          Hold to archive
        </LongPressButton>
        <LongPressButton onLongPress={() => setArchived(false)}>
          Hold to restore
        </LongPressButton>
      </div>
      <p className="text-[13px] text-stone-500 dark:text-stone-400">
        {archived ? "Archived" : "Active"}
      </p>
    </div>
  );
}

Dependencies

More by Özer

View all
  • Password Strength

    Password Strength

    1.3K
  • OTP Input

    OTP Input

    802
  • Loading Button

    Loading Button

    601
  • Progress Bar

    Progress Bar

    588
  • Reorder List

    Reorder List

    310
  • Task Steps

    Task Steps

    276
  • Hold to Confirm

    Hold to Confirm

    250
  • Reading Progress

    Reading Progress

    169

More in Buttons

View all
  • Button

    Button

    14
  • Button

    Button

    34
  • Texture Button

    Texture Button

    92
  • Button Save

    Button Save

    46
  • Button

    Button

    64
  • Button Group

    Button Group

    3
  • App Store Button

    App Store Button

    454
  • Notification Button

    Notification Button

    103

Explore more

Part of interior.dev — browse the full library on 21st.dev.