Components

React component for shadcn/ui

Peeping Button

Add a shy, cursor-tracking surprise behind a familiar button face.

Loading…

Peeping Button is a free, source-available React button for shadcn/ui with shy, cursor-tracking eyes that peek out from behind the button at an irregular rhythm and tuck away when you approach or focus it. Install it with npx shadcn@latest add @tentui/peeping-button.

Example

Loading…

Features

  • Peeks at an irregular rhythm so the effect feels alive instead of mechanical.
  • Tracks fine-pointer movement with spring-smoothed pupils while the cover is open.
  • Closes when the user approaches or focuses the button, preserving a calm action state.
  • Pauses in hidden tabs and becomes still when reduced motion is requested.
  • Composes native button props and external pointer or focus handlers.

Installation

pnpm dlx shadcn@latest add @tentui/peeping-button

Usage

import { PeepingButton } from "@/components/peeping-button";
<PeepingButton onClick={() => console.log("Clicked")}>Pricing</PeepingButton>

Tune how often and how long the button peeks, or disable the automatic behavior.

<PeepingButton peekDelay={[1800, 3200]} peekDuration={1800}>
  Keep watching
</PeepingButton>

Accessibility

PeepingButton renders a native button with its visible cover providing the accessible label. The eyes and invisible sizing placeholder are hidden from assistive technology. Focus, disabled, and keyboard activation behavior remain native, while reduced-motion preferences turn off automatic peeking and pupil movement.

API reference

PropType

FAQ

How do I install the Peeping Button with shadcn?

Run npx shadcn@latest add @tentui/peeping-button after adding the @tentui registry to components.json (installation guide), or run npx shadcn@latest add https://tentui.com/r/peeping-button.json without it. The CLI copies peeping-button.tsx into your project and installs motion.

Can I use the Peeping Button as a form submit button?

Yes. It renders a native button and passes through every button prop and a ref, but type defaults to "button", so set type="submit" to submit a form.

How do I change how often the eyes peek?

Set peekDelay to a fixed delay or a [min, max] range in milliseconds (2800 to 5200 by default), and peekDuration for how long they stay out (2200 ms by default). Set autoPeek={false} to turn the peeking off and keep a plain button.

Is the Peeping Button accessible?

Yes. It is a native button whose visible label is its accessible name, and the eyes are hidden from screen readers. The cover closes when the button is hovered or focused, and peeking stops while it is disabled, in a hidden tab, or when the user prefers reduced motion.

How do I style the button face?

Use className for the button itself and coverClassName for the visible face that swings open, which is a card-colored surface with a border by default. Both accept Tailwind classes merged with the defaults.

Is the Peeping Button free to use?

Yes. The Peeping Button is free and source-available: the shadcn CLI copies its source into your project, and you can use it in unlimited personal and client projects under the TentUI License. The license doesn't allow redistributing or reselling the component itself.

All buttons and toggles
All guides

Used in blocks

All blocks