Alert
التنبيهrole="alert"
also calledinline alert، banner، callout، admonition، notice box، message bar، ألرت، تنبيه مضمّن، شريط تنبيه، بانر، تنويه، صندوق ملاحظة
An alert is a message that takes its own space in the page layout and stays there until something clear removes it: the error gets fixed, or the user presses dismiss. An inline alert goes in the content flow right beside the thing it describes, like the line under an email field saying the address is malformed. A banner runs across the top of a page or a section. It talks about the whole screen rather than one control, and it stays until someone closes it. A callout is editorial: a note or a warning inside an article or a docs page, with no user action behind it. None of the three is a toast, because a toast floats above the page and carries a timer that erases it, while an alert reserves room in the layout and pushes the content below it down. None of them is a modal either: a modal blocks the page and waits for a decision, while an alert lets the user carry on and ignore it.
If you called it…
Live specimen
Interact with the demo. Every part is real and numbered.
اشتراك الفريق ينتهي بعد ٣ أيام. جدّده من صفحة الفوترة.
تنويه: تغيير الاسم لا يغيّر رابط المساحة.
Anatomy: every part, named
Hover a row to locate it in the demo above.
Build prompt
How it behaves right-to-left
This section is ours alone.
The coloured edge
mirrorsThe coloured rule that types the alert sits at the logical start, which is the right in Arabic. Write it as border-inline-start: 3px solid and pair it with padding-inline-start; border-left and padding-left both stay on the left after the flip, which leaves the text pressed against the right edge with no inset at all. If you paint that rule with an inset shadow instead, remember that box-shadow has no logical form: inset 3px 0 0 pushes the shadow right, so the bar lands on the left inner edge whatever the page direction. Multiply the offset by a direction variable, inset calc(3px * var(--dir)) 0 0, with --dir set to -1 under [dir="rtl"].
The icon and dismiss row
mirrorsIcon at the logical start, then the text, then the dismiss button at the logical end. A plain flex row arranges itself because the inline axis follows direction, so gap plus margin-inline-start: auto on the close button is the whole job. When the button is positioned instead, as it usually is on a wide banner, write inset-inline-end: 12px rather than right: 12px. Do not add flex-direction: row-reverse under [dir="rtl"] thinking you are fixing the order: the row already flipped once, and the second flip leaves the visual order disagreeing with DOM order and with the Tab path.
Status icons never mirror
never mirrorsThe warning triangle, the exclamation mark, the i in a circle, and the check mark carry the same meaning in both directions, and when they are written as text characters rather than svg their Unicode Bidi_Mirrored property is No, so the text engine leaves them alone too. A blanket [dir="rtl"] svg { transform: scaleX(-1) } breaks exactly these and shows them back to front for nothing. The arrow in a "View details" action inside the alert is directional and does have to flip, so scope the transform to a class you put on arrows only.
Latin runs inside the message
never mirrorsError messages are full of Latin runs: a file name, an email address, a code such as ERR_502. Drop one into an Arabic sentence and the bidi algorithm reorders the full stop or the brackets around it, so the period jumps to the start of the line or the code comes apart from its delimiters. Isolate each run with <bdi>, or with dir="ltr", since the HTML default style sheet gives both of those unicode-bidi: isolate. A CSS class carrying direction: ltr on its own isolates nothing: direction sets the base of the run, while isolation is what stops the neutral characters around it joining it, so add unicode-bidi: isolate alongside.
A banner portaled out of the tree
mirrorsA page banner is often injected at the end of <body> through a portal, and logical properties resolve against the element's own computed direction, which is inherited down the DOM tree rather than the React tree. If dir="rtl" lives on <div id="app"> instead of on <html>, the banner sits outside that subtree, computes as ltr, and paints border-inline-start on the left with inset-inline-end on the right while every line of the CSS is correctly logical. Put dir on <html>, or pass dir explicitly to the portal container.
In code
Each row is one framework's word for the same thing. Take the row your project speaks.
See also
Updated · 2026-08-19