Trash Countdown

Trash Countdown is a copy-paste React component that stops trash purged before anyone restored 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/trash-countdown
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

StopsTrash purged before anyone restored

Was this component page useful?

How do I install Trash Countdown?

pnpm dlx shadcn@latest add @bollard/trash-countdown

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

How do I use Trash Countdown in React?

trash-countdown-usage.tsx
import { TrashCountdown, type TrashItem } from "@/components/ui/trash-countdown"

<TrashCountdown
  items={items}
  onRestore={(id) => setItems((list) => list?.filter((item) => item.id !== id))}
  onEmpty={() => new Promise<void>((resolve) => setTimeout(() => { setItems([]); resolve() }, 600))}
/>

What input mistakes does Trash Countdown catch?

  • Items close to permanent deletion (within soonDays)
  • Time left per item, as text and a bar
  • Recently trashed items, called out before emptying
  • New items arriving during the empty confirmation, which resets it

What props does Trash Countdown accept?

TrashCountdown props
PropTypeDefault
items* (required)

Trashed items with when they were trashed and where they restore to.

TrashItem[]—
retentionDays

Days an item stays in the trash before it's deleted forever.

number30
soonDays

Items with fewer days than this left are highlighted.

number3
recentFor

Items trashed more recently than this (ms) are called out before emptying.

numberDAY
onRestore* (required)

Put an item back. Return a promise to show progress; a rejection keeps the row.

(id: string) => void | Promise<void>—
onEmpty* (required)

Delete these items forever.

(ids: string[]) => void | Promise<void>—
title

Heading of the list.

string"Trash"
emptyLabel

Label of the empty-trash button.

string"Empty trash"
restoreLabel

Label of each restore button.

string"Restore"
nothingText

Shown when the trash is empty.

string"Trash is empty."

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

How is Trash Countdown accessible?

  • Section labelled by its title; empty toggle uses aria-expanded/aria-controls
  • Confirm area is inert until opened; focus moves to the count input; Escape cancels
  • Count input has a <label> and is described by the grew-meanwhile note
  • Countdown bars respect 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: Run purges server-side on the stated schedule and authorize empty-trash requests; keep restore possible until the purge.

  • Purge timing comes from retentionDays you pass; the server's purge job decides
  • Typing the count proves attention, not authorization

What expensive mistakes does Trash Countdown stop?

Trash purged before anyone restored

Also known as

trash · recycle bin · bin · restore · soft delete · empty trash · deleted items · 30 days

What dependencies does Trash Countdown require?

Trash Countdown facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameTrash Countdown
Registry identifier@bollard/trash-countdown
Install commandnpx shadcn@latest add @bollard/trash-countdown
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 Trash Countdown

How does Trash Countdown protect destructive mutations?

Trash Countdown prevents trash purged before anyone restored. Enforces deliberate friction against Items close to permanent deletion (within soonDays), Time left per item, as text and a bar, Recently trashed items, called out before emptying, New items arriving during the empty confirmation, which resets it. Limitation: authorize trash-countdown mutations on the server.

How do I install trash-countdown with shadcn?

Run `npx shadcn@latest add @bollard/trash-countdown`. Sources added: registry/default/trash-countdown/trash-countdown.tsx. Package requirements: lucide-react.

What props customize Trash Countdown?

Trash Countdown accepts `items`, `retentionDays`, `soonDays`, `recentFor`, `onRestore`. Configures trash, recycle bin, bin behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of trash-countdown?

Purge timing comes from retentionDays you pass; the server's purge job decides. Typing the count proves attention, not authorization Server requirement: Run purges server-side on the stated schedule and authorize empty-trash requests; keep restore possible until the purge.

How does Trash Countdown meet accessibility guidelines?

Section labelled by its title; empty toggle uses aria-expanded/aria-controls. Confirm area is inert until opened; focus moves to the count input; Escape cancels. Count input has a <label> and is described by the grew-meanwhile note. Countdown bars respect reduced motion. Minimizes errors: trash emptied by mistake, items deleted forever surprise.

Which components pair with Trash Countdown?