Retention Change

Retention Change is a copy-paste React component that stops shorter retention purged months of data 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/retention-change
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

StopsShorter retention purged months of data

Was this component page useful?

How do I install Retention Change?

pnpm dlx shadcn@latest add @bollard/retention-change

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

How do I use Retention Change in React?

retention-change-usage.tsx
import { RetentionChange, type RetentionDay } from "@/components/ui/retention-change"

<RetentionChange
  current={current}
  defaultValue={30}
  noun="events"
  history={setup.history}
  purgeAt={setup.purgeAt}
  onExport={() => new Promise((resolve) => setTimeout(resolve, 900))}
  onConfirm={(days) => new Promise<void>((resolve) => setTimeout(() => {
    setCurrent(days)
    setSaved(`Retention set to ${days} days.`)
    resolve()
  }, 600))}
/>

What input mistakes does Retention Change catch?

  • Record count and cutoff date a shorter period would delete
  • When the next purge runs
  • Roughly how many more records go each night after
  • Window in which raising it back still loses nothing
  • Confirming without an export, named on the button

What props does Retention Change accept?

RetentionChange props
PropTypeDefault
current* (required)

Retention in force today, in days.

number—
value

New retention in days. Controlled.

number—
defaultValue

Starting retention in days when uncontrolled.

numbercurrent
onValueChange

Called with the chosen retention in days.

(days: number) => void—
options

Periods to offer, in days.

number[][7, 30, 90, 365]
history* (required)

Records per day, oldest first.

RetentionDay[]—
purgeAt* (required)

When the next purge job runs.

When—
noun

Plural noun for the data, e.g. "events".

string"records"
onExport

Exports everything older than the cutoff. Shows "Export first" when given.

(olderThan: Date) => void | Promise<void>—
onConfirm* (required)

Saves the new period. A returned promise shows a pending state; a rejection is caught.

(days: number) => void | Promise<void>—
locale

BCP 47 locale for numbers and dates.

string"en-GB"
timeZone

IANA zone for the purge time and dates, e.g. the workspace's zone. Defaults to the viewer's.

string—
messages

Every visible string (see `RETENTION_CHANGE_MESSAGES`). The single-string props below still work and win.

Partial<RetentionChangeMessages>—
optionLabel(days: number) => string—
undoText(left: string) => string—
raiseText(days: string) => string—

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

How is Retention Change accessible?

  • Options are native radios in a group labelled by the title
  • Deletion summary in a polite live region
  • Chart is aria-hidden; the same facts are in text
  • Export and save buttons set aria-busy while pending; icons are aria-hidden

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 the new retention server-side with its own grace period, and make the purge job re-check the setting before deleting.

  • Counts come from the daily history you pass; days are UTC calendar days
  • The chart is a summary (bars group days) and is hidden from screen readers; the text states the numbers
  • Does not delete or export anything itself

What expensive mistakes does Retention Change stop?

Shorter retention purged months of data

Also known as

data retention · retention period · logs · purge · analytics events · compliance · export · ttl

Field type

What dependencies does Retention Change require?

Retention Change facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameRetention Change
Registry identifier@bollard/retention-change
Install commandnpx shadcn@latest add @bollard/retention-change
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 Retention Change

How does Retention Change protect destructive mutations?

Retention Change prevents shorter retention purged months of data. Enforces deliberate friction against Record count and cutoff date a shorter period would delete, When the next purge runs, Roughly how many more records go each night after, Window in which raising it back still loses nothing, Confirming without an export, named on the button. Limitation: authorize retention-change mutations on the server.

How do I install retention-change with shadcn?

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

What props customize Retention Change?

Retention Change accepts `current`, `value`, `defaultValue`, `onValueChange`, `options`. Configures data retention, retention period, logs behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of retention-change?

Counts come from the daily history you pass; days are UTC calendar days. The chart is a summary (bars group days) and is hidden from screen readers; the text states the numbers. Does not delete or export anything itself Server requirement: Apply the new retention server-side with its own grace period, and make the purge job re-check the setting before deleting.

How does Retention Change meet accessibility guidelines?

Options are native radios in a group labelled by the title. Deletion summary in a polite live region. Chart is aria-hidden; the same facts are in text. Export and save buttons set aria-busy while pending; icons are aria-hidden. Minimizes errors: lowered retention deleted data, data retention change.

Which components pair with Retention Change?