Stale Attachment Check

Stale Attachment Check is a copy-paste React component that stops old draft attached instead of final before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/stale-attachment-check
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsOld draft attached instead of final

Was this component page useful?

How do I install Stale Attachment Check?

pnpm dlx shadcn@latest add @bollard/stale-attachment-check

The files land in your project. They're yours to edit.

How do I use Stale Attachment Check in React?

stale-attachment-check-usage.tsx
import { StaleAttachmentCheck, type StaleFile } from "@/components/ui/stale-attachment-check"

<StaleAttachmentCheck
  defaultValue={attached}
  nearby={folder}
  subject="Q3 report and minutes, 10 Oct"
  now={NOW}
  locale="en-IN"
  onSend={(files) => setSent(files.map((file) => file.name).join(", "))}
/>

What input mistakes does Stale Attachment Check catch?

  • A newer file of the same document nearby
  • Names containing draft, old, copy or (1)
  • Office lock files (~$…)
  • Files last modified before a date named in the subject
  • One-tap swap to the newer file, with Undo

What props does Stale Attachment Check accept?

StaleAttachmentCheck props
PropTypeDefault
value

Controlled attachments.

StaleFile[]—
defaultValue

Initial attachments when uncontrolled.

StaleFile[][]
onValueChange

Called with the new list after a swap or undo.

(files: StaleFile[]) => void—
nearby

Files beside the attachments: the same folder, drive or recent files.

StaleFile[][]
subject

The email subject, for "Minutes 14 Oct" style dates.

string""
now

"Now" in epoch ms, for deterministic rendering. Read from the clock after mount when omitted.

number—
graceDays

Days an edit may come before the subject's date without a warning ("deck for today's meeting").

number1
locale

Locale for dates.

string—
onSend

Called on Send. With warnings left, the first click jumps to them and the second sends. May return a Promise.

(files: StaleFile[]) => void | Promise<void>—
messages

Any visible string.

Partial<StaleAttachmentMessages>—

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Stale Attachment Check accessible?

  • Summary in a polite live region; status shown with icon and text
  • Focus moves to the next fix, Undo or Send as issues are resolved
  • Fix and Undo are labelled buttons

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Only sees the nearby files you pass; it can't browse folders
  • Name matching ignores filler words, so different documents with similar names can be confused
  • Modified dates can be wrong after copying or syncing

What expensive mistakes does Stale Attachment Check stop?

Old draft attached instead of final

Also known as

attachment · file version · final_final · email attach · upload · compose · proposal · invoice pdf

Field type

What dependencies does Stale Attachment Check require?

Stale Attachment Check facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameStale Attachment Check
Registry identifier@bollard/stale-attachment-check
Install commandnpx shadcn@latest add @bollard/stale-attachment-check
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Stale Attachment Check

What form validation mistake does Stale Attachment Check catch?

Stale Attachment Check prevents old draft attached instead of final. Flags an attachment that looks like an older copy, e.g. report_v2.pdf attached while report_v3_final.pdf was edited today. Catches: A newer file of the same document nearby, Names containing draft, old, copy or (1), Office lock files (~$…), Files last modified before a date named in the subject, One-tap swap to the newer file, with Undo. Limitation: validate stale-attachment-check schemas on backend.

How do I install stale-attachment-check with shadcn?

Run `npx shadcn@latest add @bollard/stale-attachment-check`. Sources added: registry/default/stale-attachment-check/stale-attachment-check.tsx, registry/default/stale-attachment-check/stale.ts. Package requirements: lucide-react.

What props customize Stale Attachment Check?

Stale Attachment Check accepts `value`, `defaultValue`, `onValueChange`, `nearby`, `subject`. Configures attachment, file version, final_final behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of stale-attachment-check?

Only sees the nearby files you pass; it can't browse folders. Name matching ignores filler words, so different documents with similar names can be confused. Modified dates can be wrong after copying or syncing Server requirement: backend verification for stale-attachment-check.

How does Stale Attachment Check meet accessibility guidelines?

Summary in a polite live region; status shown with icon and text. Focus moves to the next fix, Undo or Send as issues are resolved. Fix and Undo are labelled buttons. Minimizes errors: attached old version, sent draft not final.

Which components pair with Stale Attachment Check?