Alert
Static message container for persistent inline feedback.
- المتصفحات
- Chrome 123+Firefox 121+Safari 17.5+
- الفئة
- 0
- الحجم المضغوط
- 387 B
- ميزانية التخطيط القسري
- 0 ms
- ميزانية axe
- 0
- متوافق مع SSR
- نعم
- العقد المنشور
- بيئة الاختبار
المختبر
Alert
Warning: browser support is incomplete.
Check the support matrix before release.
أمثلة
Outcome messages
The variant provides the status symbol and accent; keep the meaning clear in the title and description.
Payment successful
Your payment has been processed successfully.
Upload failed
Check your connection and try again.
Action needs review
Check the support matrix before release.
Update available
Review the latest changes in this release.
import { Alert, AlertDescription, AlertTitle } from "@gunkin/uiify";
export default function Example() {
return (
<>
<Alert variant="success">
<AlertTitle>Payment successful</AlertTitle>
<AlertDescription>Your payment has been processed successfully.</AlertDescription>
</Alert>
<Alert variant="destructive">
<AlertTitle>Upload failed</AlertTitle>
<AlertDescription>Check your connection and try again.</AlertDescription>
</Alert>
<Alert variant="warning">
<AlertTitle>Action needs review</AlertTitle>
<AlertDescription>Check the support matrix before release.</AlertDescription>
</Alert>
<Alert variant="secondary">
<AlertTitle>Update available</AlertTitle>
<AlertDescription>Review the latest changes in this release.</AlertDescription>
</Alert>
</>
);
}API
Alert
| الخاصية | النوع | افتراضي | الوصف |
|---|---|---|---|
children | ReactNode | — | AlertTitle, AlertDescription, or custom message content. |
variant | "secondary" | "success" | "warning" | "destructive" | "secondary" | Visual meaning written to data-variant; keep severity understandable in text. |
symbol | string | false | ⓘ / ✓ / ⚠︎ / × | Override the decorative text symbol, or pass false to hide it. The default comes from variant. |
as | ElementType | "div" | Native element or component used for the root. |
role | "status" | "alert" | — | Choose a live role only when message timing and urgency warrant announcement. |
className | string | — | الفئة المطبّقة على العنصر الجذر. |
style | CSSProperties | — | Native root styles. |
ref | Ref<HTMLElement> | — | Ref forwarded to the rendered root element. |
render | (props, state) => ReactElement | null | — | استبدل العنصر المعروض مع الحفاظ على توصيلات السلوك وإمكانية الوصول. |
AlertTitle
| الخاصية | النوع | افتراضي | الوصف |
|---|---|---|---|
children | ReactNode | — | Content rendered by this alert part. |
as | ElementType | "div" | Native element or component used for the root. |
className / style / ref / native props | native div props | — | Native element props, styles, events, and ref are forwarded. |
render | (props, state) => ReactElement | null | — | استبدل العنصر المعروض مع الحفاظ على توصيلات السلوك وإمكانية الوصول. |
AlertDescription
| الخاصية | النوع | افتراضي | الوصف |
|---|---|---|---|
children | ReactNode | — | Content rendered by this alert part. |
as | ElementType | "div" | Native element or component used for the root. |
className / style / ref / native props | native div props | — | Native element props, styles, events, and ref are forwarded. |
render | (props, state) => ReactElement | null | — | استبدل العنصر المعروض مع الحفاظ على توصيلات السلوك وإمكانية الوصول. |
لوحة المفاتيح
| المفتاح | الإجراء |
|---|
إمكانية الوصول
Persistent inline message with no live role by default. Add role=status or role=alert only when a dynamic update's timing and urgency warrant announcement.
نقاط التنسيق
data-uiify-alertdata-uiify-alert-titledata-uiify-alert-descriptiondata-part="symbol|title|description"data-variant