Data display
ChangeList
What a save changes: each value before and after. Secret values show only as changed.
import { ChangeList, type ChangeItem } from "@percentsa/ui";Examples
Main website
- Domainfromold.example.comtoshop.example.com
- Memoryfrom512 MBto1 GB
Shop
- PortfromNot setto8080
- API keyChanged (value hidden)
The site restarts after saving.
4 changes: Domain, Memory, Port, API key
Code
export function ChangeListExample() {
const t = useT();
const items = [
{ group: t("Main website", "الموقع الرئيسي"), label: t("Domain", "النطاق"), before: "old.example.com", after: "shop.example.com" },
{ group: t("Main website", "الموقع الرئيسي"), label: t("Memory", "الذاكرة"), before: "512 MB", after: "1 GB" },
{ group: t("Shop", "المتجر"), label: t("Port", "المنفذ"), before: null, after: "8080" },
{ group: t("Shop", "المتجر"), label: t("API key", "مفتاح الواجهة"), before: "", after: "", hidden: true },
];
return (
<div className="grid w-full max-w-xl gap-6">
<ChangeList items={items} note={t("The site restarts after saving.", "يعاد تشغيل الموقع بعد الحفظ.")} />
<FormBar sticky={false} summary={<ChangeList compact items={items} />}>
<Button variant="ghost">{t("Cancel", "إلغاء")}</Button>
<Button>{t("Save", "حفظ")}</Button>
</FormBar>
</div>
);
}