Skip to content
Component installs need the registry setup
VegaStack Design

Value Change

An inline before → after diff of one value — the old value struck through, a muted arrow, the new value — for activity feeds, audit logs and impact reviews.

Status
stable
Since
0.25.19
Accessibility pattern
del/ins semantics, spoken "changed from A to B"

Last updated

Status changed from Draft to Published

Install

Configure registry credentials first using the Quickstart. Before copying this item or any transitive registry dependency, verify the signed manifest and save the exact bytes for Value Change before installation. Retain the digest printed by this command.

pnpm exec vegastack-design verify value-change

Install with the pinned shadcn CLI. Bare shadcn does not verify VegaStack signature or integrity.

pnpm dlx shadcn@4.21.0 add @vegastack/value-change

Run the exact offline --post-write command printed by the preflight, using its saved item path and independently retained --expected-integrity digest. Use the saved preflight for every transitive registry dependency too; stop on any mismatch before using the components.

Usage

import { ValueChange } from "@/components/ui/value-change";

<ValueChange before="Draft" after="Published" />;
<ValueChange before={null} after="Asha Kumar" />; // added
<ValueChange before="25 Oct" after={null} />; // removed

Examples

Changed

Both sides present: the old value in a <del>, struck through in the destructive ink, a muted arrow, and the new value in an <ins> in the success ink with no underline. It sits inline in a sentence and inherits the surrounding text size.

Status changed from Draft to Published

Added and removed

Only after is an addition and only before a removal — the absent side and the arrow are not drawn. null, undefined, booleans and an empty string count as absent; 0 does not. With neither side it renders nothing.

Price
changed from ₹1,200 to ₹1,450
Owner
added Asha Kumar
Due date
removed 25 Oct

Narrow container

The row wraps: a long value breaks onto its own line rather than widening its container.

changed from Stainless steel, brushed finish to Anodised aluminium, matte black

API Reference

PropTypeDefaultDescription
afterReact.ReactNode—The new value, in the success ink. null (or omitted) when the value was removed.
beforeReact.ReactNode—The old value, struck through in the destructive ink. null (or omitted) when the value was added rather than changed.

Data attributes and CSS variables on ValueChange

AttributeValues
data-changemirrors a prop or state value
data-slot"value-change" | "value-change-after" | "value-change-arrow" | "value-change-before"

Accessibility

  • The values are real <del> and <ins> elements, so the edit survives copy, reader mode and assistive tech that announces insertions and deletions.
  • The arrow is aria-hidden; visually hidden connectives make the spoken sentence "changed from Draft to Published", "added Asha Kumar" or "removed 25 Oct". Each value is rendered once.
  • Colour is never the only cue: the removed value is also struck through, and the sentence says which side is which.
  • The component is server-safe — no client boundary.
ContractStates tested
Behaviourchanged, added, removed, empty
Accessibilitysemantic-html, labeled
Visualchanged, added, removed

Do / Don't

Do
Use ValueChange for one field's old and new value in an activity item, audit log or impact review.
Don't
Use it to compare whole texts — that is DiffView — or to show a number's trend, which is Stat.

On this page