Feedback
EmptyState
What to show when there is nothing yet, with the next action. tone="error" shows a load error, announced at once; onRetry adds a “Try again” button. variant="plain" has no dashed frame, for an empty state inside a table, a card or a sheet (DataTable uses it for its own).
import { EmptyState } from "@percentsa/ui";Examples
No projects yet
Projects you start appear here.
Code
export function EmptyStateExample() {
const t = useT();
return (
<div className="w-full max-w-lg">
<EmptyState
icon={<FolderOpen aria-hidden />}
title={t("No projects yet", "لا توجد مشاريع بعد")}
description={t("Projects you start appear here.", "تظهر هنا المشاريع التي تبدؤها.")}
action={<Button>{t("Start a project", "ابدأ مشروعًا")}</Button>}
/>
</div>
);
}
/** `variant="plain"`: no frame, for an empty state inside a card (DataTable uses it for its own). */The orders did not load
Check the connection and try again.
Code
export function EmptyStateErrorExample() {
const t = useT();
return (
<div className="w-full max-w-lg">
<EmptyState tone="error" title={t("The orders did not load", "تعذر تحميل الطلبات")} description={t("Check the connection and try again.", "تحقق من الاتصال وحاول مرة أخرى.")} onRetry={() => {}} />
</div>
);
}Orders
No orders yet
Code
export function EmptyStatePlainExample() {
const t = useT();
return (
<Card className="w-full max-w-lg" title={t("Orders", "الطلبات")}>
<EmptyState variant="plain" title={t("No orders yet", "لا توجد طلبات بعد")} />
</Card>
);
}