Prompt Data Guard

Prompt Data Guard is a copy-paste React component that stops helps keep a customer list out of an ai chat 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/prompt-data-guard
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 2 extra npm packages
  • A11y guidance in docs

StopsHelps keep a customer list out of an AI chat

Was this component page useful?

How do I install Prompt Data Guard?

pnpm dlx shadcn@latest add @bollard/prompt-data-guard

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

How do I use Prompt Data Guard in React?

prompt-data-guard-usage.tsx
import { PromptDataGuard, restoreStandIns, type PromptAttachment } from "@/components/ui/prompt-data-guard"

<PromptDataGuard
  value={text}
  onValueChange={setText}
  attachments={files}
  onRemoveAttachment={(id) => setFiles((f) => f.filter((x) => x.id !== id))}
  destination={{ name: "OpenAI", retention: "up to 30 days" }}
  placeholder="Ask anything"
  onSend={async ({ mapping, protected: safe }) => {
    await new Promise((r) => setTimeout(r, 500))
    // The model only ever saw stand-ins; the real names come back on this device.
    const fromModel = "Top churn risk: <NAME_3> (‹EMAIL_3›), last seen 90 days ago. Draft: \"Hi ‹NAME_3›, we miss you…\""
    setReply(safe ? restoreStandIns(fromModel, mapping) : "Top churn risk: Meera Rao, last seen 90 days ago.")
    setText("")
  }}
/>

What input mistakes does Prompt Data Guard catch?

  • Pasted tables with personal data, counted by row
  • Names in name columns and their other mentions
  • Emails, phones, card numbers, Aadhaar and PAN
  • API keys and other secrets (via detectSecrets)
  • CONFIDENTIAL markings in attachments

What props does Prompt Data Guard accept?

PromptDataGuard props
PropTypeDefault
value

Controlled message text.

string—
defaultValue

Initial message text when uncontrolled.

string""
onValueChange

Called with the text on every change.

(value: string) => void—
attachments

Files attached to the message.

PromptAttachment[]NO_ATTACHMENTS
onRemoveAttachment

Called with an attachment's id to remove it.

(id: string) => void—
destination

Who receives the message and for how long they keep it, e.g. { name: "OpenAI", retention: "30 days" }.

{ name: string; retention?: string; training?: boolean }{ name: "the AI provider" }
onSend

Sends the message. May return a Promise: the button shows a pending state and can't fire twice.

(payload: PromptSendPayload) => void | Promise<void>—
detectSecrets

Secret finder. Defaults to secret-paste-guard's; pass false to skip secrets.

SecretDetector | falsedefaultSecrets
detectNames

Optional name finder for free text (an NER model, your CRM's contact list). Names in table name columns are always caught.

NameDetector—
className

Extra classes for the root.

string—
textareaClassName

Extra classes for the textarea.

string—
messages

Override any visible string, including per-kind and chip texts.

Partial<Omit<Messages, "kind" | "chip">> & { kind?: Partial<Record<DataKind, string>>; chip?: Partial<Record<DataKind, string>> }—

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

How is Prompt Data Guard accessible?

  • Visible label; textarea is described by the readback when risky
  • Remove-attachment buttons have aria-labels naming the file
  • Focus returns to the field after changes; animations are skipped under reduced motion

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

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Apply DLP and redaction on the server or gateway before data reaches the model provider.

  • Names in free text need your detectNames (an NER model or CRM list)
  • Destination and retention text come from your destination prop
  • Detection is pattern-based; it can miss data or flag harmless text

What expensive mistakes does Prompt Data Guard stop?

Helps keep a customer list out of an AI chat

Also known as

ai chat · chat composer · prompt box · data loss prevention · dlp · pseudonymize · redact · openai

Field type

What dependencies does Prompt Data Guard require?

Prompt Data Guard facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component namePrompt Data Guard
Registry identifier@bollard/prompt-data-guard
Install commandnpx shadcn@latest add @bollard/prompt-data-guard
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, motion
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 Prompt Data Guard

What form validation mistake does Prompt Data Guard catch?

Prompt Data Guard prevents helps keep a customer list out of an AI chat. Before a message goes to an AI chat, says exactly what personal data, secrets or confidential documents are in it and where they'll go. Catches: Pasted tables with personal data, counted by row, Names in name columns and their other mentions, Emails, phones, card numbers, Aadhaar and PAN, API keys and other secrets (via detectSecrets), CONFIDENTIAL markings in attachments. Limitation: validate prompt-data-guard schemas on backend.

How do I install prompt-data-guard with shadcn?

Run `npx shadcn@latest add @bollard/prompt-data-guard`. Sources added: registry/default/prompt-data-guard/prompt-data-guard.tsx, registry/default/prompt-data-guard/stand-ins.ts. Package requirements: lucide-react, motion.

What props customize Prompt Data Guard?

Prompt Data Guard accepts `value`, `defaultValue`, `onValueChange`, `attachments`, `onRemoveAttachment`. Configures ai chat, chat composer, prompt box behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of prompt-data-guard?

Names in free text need your detectNames (an NER model or CRM list). Destination and retention text come from your destination prop. Detection is pattern-based; it can miss data or flag harmless text Server requirement: Apply DLP and redaction on the server or gateway before data reaches the model provider.

How does Prompt Data Guard meet accessibility guidelines?

Visible label; textarea is described by the readback when risky. Remove-attachment buttons have aria-labels naming the file. Focus returns to the field after changes; animations are skipped under reduced motion. Minimizes errors: pasted customer data into chatgpt, confidential document sent to ai.

Which components pair with Prompt Data Guard?