Feedback
Alert
A message in the page. Errors and warnings are announced at once. collapsible folds it on a phone (below 768 px) to the icon, the title and a Show button.
import { Alert } from "@percentsa/ui";Examples
New version
Version 2.4 is live.
Message sent
Invoice due in 3 days
Payment failed
The bank declined the card.
Code
export function AlertExample() {
const t = useT();
return (
<Stack gap={3} className="w-full max-w-xl">
<Alert title={t("New version", "إصدار جديد")}>{t("Version 2.4 is live.", "الإصدار 2.4 متاح الآن.")}</Alert>
<Alert tone="success" title={t("Message sent", "أُرسلت الرسالة")} />
<Alert tone="warning" title={t("Invoice due in 3 days", "تستحق الفاتورة خلال 3 أيام")} />
<Alert tone="danger" title={t("Payment failed", "فشل الدفع")} action={<Button size="sm" variant="secondary">{t("Retry", "أعد المحاولة")}</Button>}>
{t("The bank declined the card.", "رفض البنك البطاقة.")}
</Alert>
</Stack>
);
}Backup is late
The last run failed. Narrow the window to see it fold.
Code
export function AlertCollapsibleExample() {
const t = useT();
return (
<Alert collapsible tone="warning" title={t("Backup is late", "النسخ الاحتياطي متأخر")} action={<Button size="sm" variant="secondary">{t("Run now", "شغّل الآن")}</Button>} className="w-full max-w-xl">
{t("The last run failed. Narrow the window to see it fold.", "فشل التشغيل الأخير. ضيّق النافذة لترى الطي.")}
</Alert>
);
}