Retract Window

Retract Window is a copy-paste React component that stops trusted an unsend that didn't work 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/retract-window
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

StopsTrusted an unsend that didn't work

Was this component page useful?

How do I install Retract Window?

pnpm dlx shadcn@latest add @bollard/retract-window

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

How do I use Retract Window in React?

retract-window-usage.tsx
import { RetractWindow } from "@/components/ui/retract-window"

<RetractWindow
  sentAt={SENT}
  now={NOW}
  timeZone="Asia/Kolkata"
  policy="imessage"
  editsUsed={1}
  recipients={[
    { id: "p", name: "Priya", read: true },
    { id: "r", name: "Rahul", canRetract: false },
    { id: "a", name: "Anu" },
  ]}
  onEdit={() => setLog("Editing…")}
  onUnsend={() => new Promise<void>((resolve) => setTimeout(resolve, 700))}
  onDeleteForMe={() => setLog("Deleted from this phone only.")}
  onSendCorrection={() => setLog("Writing a correction…")}
>
  Salary bands for the team are in the sheet, 18–24 LPA. Sharing with HR only.
</RetractWindow>

What input mistakes does Retract Window catch?

  • Time left to edit and to unsend, per the platform's rules
  • Edits used against a limit (iMessage: 5)
  • Recipients who already read it or whose app keeps the original
  • "Delete for me" labelled as leaving everyone else's copy
  • Who still has it after an unsend, and a correction once windows close

What props does Retract Window accept?

RetractWindow props
PropTypeDefault
children

The sent message, rendered as a bubble.

React.ReactNode—
sentAt* (required)

When the message was sent.

Date | string | number—
policy

A preset ("imessage", "whatsapp", "slack") or your own rules.

RetractPlatform | RetractPolicy"imessage"
recipients

Who it went to, whether they've read it and whether their app can remove it.

RetractRecipient[][]
editsUsed

Edits already made (iMessage allows five).

number0
now

Pass for a deterministic start; the countdown then runs from it. Otherwise the clock is read after mount.

Date—
timeZone

IANA zone for displayed times.

string—
locale

Locale for displayed times.

string"en-IN"
onEdit

Opens the editor. Without it there's no Edit row.

() => void—
onUnsend

Removes it for everyone. Return a promise for a pending state; a rejection means it stayed.

() => void | Promise<void>—
onDeleteForMe

Removes it only from this device.

() => void—
onSendCorrection

Offered once the windows have closed or an unsend fails.

() => void—
messages

Override any visible string.

Partial<RetractWindowMessages>—

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

How is Retract Window accessible?

  • Edit/Unsend buttons are described by their window text (aria-describedby)
  • Only a window closing is announced (role=status), never the countdown
  • Failures use role=alert; after unsend, focus moves to the result
  • The draining bar is aria-hidden; time left is also text

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

What are the limitations and server boundaries?

  • Presets reflect the platforms' help pages as of the verified date and change without notice
  • Slack windows depend on each workspace's admin settings; pass the real limits
  • Does not edit or unsend; your callbacks do, and a failed unsend shows an error

What validation rules apply to Retract Window?

Rules last verified:

Confirmed: iMessage unsend 2 min, edit up to 5 times within 15 min; WhatsApp edit 15 min, Delete for everyone within two days; Slack members can edit/delete any time by default, admins can limit. Check the platforms' current help pages. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What expensive mistakes does Retract Window stop?

Trusted an unsend that didn't work

Also known as

unsend · delete for everyone · edit message · whatsapp · imessage · slack · recall · chat

Field type

What dependencies does Retract Window require?

Retract Window facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameRetract Window
Registry identifier@bollard/retract-window
Install commandnpx shadcn@latest add @bollard/retract-window
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 Retract Window

What form validation mistake does Retract Window catch?

Retract Window prevents trusted an unsend that didn't work. Shows how long Edit and Unsend really stay open for a sent message, and who will keep the original anyway. Catches: Time left to edit and to unsend, per the platform's rules, Edits used against a limit (iMessage: 5), Recipients who already read it or whose app keeps the original, "Delete for me" labelled as leaving everyone else's copy, Who still has it after an unsend, and a correction once windows close. Limitation: validate retract-window schemas on backend.

How do I install retract-window with shadcn?

Run `npx shadcn@latest add @bollard/retract-window`. Sources added: registry/default/retract-window/policies.ts, registry/default/retract-window/retract-window.tsx. Package requirements: lucide-react.

What props customize Retract Window?

Retract Window accepts `children`, `sentAt`, `policy`, `recipients`, `editsUsed`. Configures unsend, delete for everyone, edit message behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of retract-window?

Presets reflect the platforms' help pages as of the verified date and change without notice. Slack windows depend on each workspace's admin settings; pass the real limits. Does not edit or unsend; your callbacks do, and a failed unsend shows an error Server requirement: backend verification for retract-window.

How does Retract Window meet accessibility guidelines?

Edit/Unsend buttons are described by their window text (aria-describedby). Only a window closing is announced (role=status), never the countdown. Failures use role=alert; after unsend, focus moves to the result. The draining bar is aria-hidden; time left is also text. Minimizes errors: unsend didn't work, delete for everyone failed.

Which components pair with Retract Window?