Dependent Reset

Dependent Reset is a copy-paste React component that stops dependent fields cleared without notice 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/dependent-reset
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

StopsDependent fields cleared without notice

Was this component page useful?

How do I install Dependent Reset?

pnpm dlx shadcn@latest add @bollard/dependent-reset

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

How do I use Dependent Reset in React?

dependent-reset-usage.tsx
import { DependentResetNotice, clearedFieldClass, useDependentReset, type DependentRules, } from "@/components/ui/dependent-reset"

<DependentResetNotice notice={form.notice} onUndo={form.undo} onDismiss={form.dismiss} />

What input mistakes does Dependent Reset catch?

  • Dependent values that became invalid after a parent change
  • Partial loss (some options pruned) versus a field cleared entirely
  • Silent data loss, by naming each value and offering Undo

What props does Dependent Reset accept?

DependentResetNotice props
PropTypeDefault
notice* (required)

The notice from `useDependentReset`.

ResetNotice<T> | null—
onUndo* (required)

Restore the change and everything it cleared.

() => void—
onDismiss* (required)

Close the notice and keep the new values.

() => void—
message

`{count}` ("2 fields") and `{cause}` ("Country") are filled in.

string"{count} cleared because you changed {cause}."
fieldWord

Word for one field and for several.

[singular: string, plural: string]["field", "fields"]
removedSuffix

Shown after the items a list lost.

string"removed"
clearedSuffix

Read to screen readers after a fully cleared value.

string"cleared"
undoLabel

Button labels.

string"Undo"
dismissLabel

Accessible label for the dismiss button.

string"Dismiss"

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

How is Dependent Reset accessible?

  • The notice is role="status" with aria-live="polite"
  • Each lost field is described in text (e.g. "cleared" or "removed")
  • Dismiss has an aria-label

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

What are the limitations and server boundaries?

  • You define which values are valid for each parent value
  • Undo restores the previous values in the form; it doesn't undo anything already saved

What expensive mistakes does Dependent Reset stop?

Dependent fields cleared without notice

Also known as

dependent fields · cascading select · country state city · conditional fields · add-ons · plan picker · react hook form

Field type

What dependencies does Dependent Reset require?

Dependent Reset facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameDependent Reset
Registry identifier@bollard/dependent-reset
Install commandnpx shadcn@latest add @bollard/dependent-reset
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 Dependent Reset

How does Dependent Reset prevent financial transaction errors?

Dependent Reset prevents dependent fields cleared without notice. Blocks Dependent values that became invalid after a parent change, Partial loss (some options pruned) versus a field cleared entirely, Silent data loss, by naming each value and offering Undo before processing. Limitation: apply idempotency keys for dependent-reset.

How do I install dependent-reset with shadcn?

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

What props customize Dependent Reset?

Dependent Reset accepts `notice`, `onUndo`, `onDismiss`, `message`, `fieldWord`. Configures dependent fields, cascading select, country state city behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of dependent-reset?

You define which values are valid for each parent value. Undo restores the previous values in the form; it doesn't undo anything already saved Server requirement: backend verification for dependent-reset.

How does Dependent Reset meet accessibility guidelines?

The notice is role="status" with aria-live="polite". Each lost field is described in text (e.g. "cleared" or "removed"). Dismiss has an aria-label. Minimizes errors: changing country cleared state, plan change removed add-ons.

Which components pair with Dependent Reset?