Skip to content

HoneypotField

SM · 950B gzip budget

A bot trap invisible to real users without trapping keyboard or screen reader users.

Category
Forms & input
Budget
sm, single-purpose control
External runtime
React / React DOM only
axe fixtureSSR rendersource scanbundle budget

Preview

Live fixture
Preview locale

Try the component here. Locale-aware formatting and direction follow the selected language; example content and labels are not automatically translated. Overlay demos use interactive launchers.

Install

npx shadcn@latest add https://gear5-ui.vercel.app/r/honeypot-field.json

Copies the source into your project. Pulls in 1 shared registry item: visually-hidden.

New here? Set up Tailwind and import aliases first →

Source & props

Edit on GitHub ↗

Prop types and inline documentation are included below. This is repository source; the installer rewrites shared imports for your project.

import { VisuallyHidden } from "./visually-hidden";

export interface HoneypotFieldProps {
  name?: string;
}

/**
 * A bot trap that stays invisible to real users without becoming invisible
 * to assistive technology in the wrong way. `VisuallyHidden` (clip-based, not
 * `display: none`) keeps it out of the visual layout while `tabIndex={-1}`
 * and `aria-hidden` keep a keyboard or screen reader user from ever landing
 * on it — a simple bot filling every field still fills this one.
 *
 * Server-side: reject the submission if this field arrives non-empty.
 */
export function HoneypotField({ name = "company_website" }: HoneypotFieldProps) {
  return (
    <VisuallyHidden as="div">
      <label htmlFor={`hp-${name}`}>Leave this field empty</label>
      <input id={`hp-${name}`} name={name} type="text" tabIndex={-1} autoComplete="off" aria-hidden="true" />
    </VisuallyHidden>
  );
}

What CI checks

Quality contract
  • Bundled, minified and gzipped against its tier budget
  • Audited by axe in the state previewed above
  • Rendered through react-dom/server with no browser globals
  • Scanned for network calls, dangerous sinks, and unguarded animation