انتقل إلى المحتوى
TopClass UI

شريط إعلان

رسالة واحدة للصفحة كلها، بعرض كامل فوق الترويسة. يقع في تدفق الصفحة، فيدفعها إلى الأسفل ولا يغطي شيئًا.

split - الحجم لم يُقَس بعد

شريط إعلان

split - الحجم لم يُقَس بعد

رسالة واحدة للصفحة كلها، بعرض كامل فوق الترويسة. يقع في تدفق الصفحة، فيدفعها إلى الأسفل ولا يغطي شيئًا.

تثبيت

جرّبه

tone
dismissible

الشيفرة

banner.tsx
import { bell } from 'topclassui/icons/bell'
import { Button } from 'topclassui/button'
import { Svg } from 'topclassui/svg'
import { Banner } from 'topclassui/banner'

<Banner
  id="banner-playground"
  aria-label="Version 2 announcement"
  icon={<Svg icon={bell} size="xs" />}
  action={<Button size="sm" variant="outline" tone="neutral" render={<a href="/changelog" />}>Read the changelog</Button>}
>
  Version 2 is out, with faster builds and a new theme editor.
</Banner>

الإخفاء يُحفظ حسب المعرّف في هذا المتصفح، فغيّر المعرّف عندما تتغير الرسالة.

كل الحالات، بدون تمرير الفأرة

9 حالات
Primary
Neutral
Success
Warning
Danger
Info
No icon
With action

أو استورده من الحزمة

topclassui/banner
import { Banner } from 'topclassui/banner'

ثبّت مرة واحدة:npm i topclassui@beta zod

أمثلة

  • لرسالة واحدة يجب أن تراها الصفحة كلها: إصدار جديد، أو فترة تجريبية تنتهي، أو صيانة مجدولة. ضعه فوق الترويسة.
  • الإجراء الذي هو رابط يكون زرًا مع render={<a href="..." />}؛ الرابط المجرد بلا تنسيق وبلا مساحة لمس 44 بكسل. وإذا لم تتسع الرسالة والإجراء لسطر واحد ينتقل الإجراء تحت الرسالة.
  • مرّر icon عندما تهمّ النبرة: اللون وحده لا يميّز التحذير من الإشعار العادي.
  • dismissible وid قيم عادية، فصفحة مكوّن خادم لا تحتاج إلى غلاف عميل، ولا يشحن الجزءَ العامل في المتصفح إلا الشريطُ القابل للإخفاء. أما onDismiss فدالة، فلا يمررها إلا ملف عميل.
  • الخادم لا يقرأ تخزين الزائر، فالصفحة التالية تعرض الشريط المُخفى حتى يعمل السكربت فيزيله، فتصعد الصفحة تحته. لهذا يكون dismissible معطّلًا افتراضيًا.
basic
Version 2 is out, with faster builds and a new theme editor.
Read the changelog
tones
A new plan is available.
You are viewing an archived project.
Your domain is verified.
Your trial ends in three days.
The last payment failed.
Version 2 is out.
with-action
Your trial ends in three days.
Add a payment method
The last payment failed, so deploys are paused.
Compare plans
dismissible
Version 2 is out, with faster builds and a new theme editor.
Read the changelog
Scheduled maintenance starts on Sunday at 02:00 UTC.
minimal
Scheduled maintenance starts on Sunday at 02:00 UTC.
long-action
Your workspace has used its monthly build minutes, so new deployments wait until the plan is upgraded.
Upgrade the workspace plan and resume deployments now
تجاوزت مساحة العمل دقائق البناء الشهرية، لذلك تنتظر عمليات النشر الجديدة حتى تتم ترقية الخطة.
long-text
The deploy is taking longer than usual while the static assets upload to the edge network.
Status
https://example.com/projects/topclassui/deployments/2026-10-09/logs/build-step-four-of-six.txt
بالعربية، من اليمين إلى اليسار
صدر الإصدار الثاني، مع بناء أسرع ومحرر جديد للسمات.
اقرأ المزيد
تنتهي الفترة التجريبية بعد ثلاثة أيام.

الخصائص

خصائص Banner
الخاصيةالنوعالافتراضيالحدودالوصف
aria-labelstring--The name of the landmark, such as "Release announcement".
aria-labelledbystring--The id of the visible text that names the landmark.
idstring--The key the dismissal is remembered under, and the element's id. Required with dismissible.
actionReactNode--The caller's link or Button, after the message.
childrenReactNode--The message: a sentence that wraps and is never cut.
dismissiblebooleanfalse-Adds an x that hides the banner and remembers it in this browser. Requires id.
iconReactNode--Shown before the message, such as a 16 px Svg. Leave it out for none.
toneprimary | neutral | success | warning | danger | info"primary"-What the message means, which picks the soft fill and the text colour on it.

لوحة المفاتيح وإمكانية الوصول

لوحة مفاتيح Banner
المفاتيحما يفعله
Tabيصل إلى الإجراء، ثم إلى زر الإغلاق.
EnterSpaceعلى زر الإغلاق، يخفي الشريط ويحفظ ذلك في هذا المتصفح. يسقط التركيز إلى الصفحة؛ انقله داخل onDismiss لتضعه في مكان محدد.
  • شريط الإعلان معلَم من نوع region، فيحتاج إلى اسم: مرّر aria-label أو aria-labelledby. النوع يرفض شريطًا بلا أيٍّ منهما، والشريطان في صفحة واحدة يحتاجان إلى اسمين.
  • زر الإغلاق 24 بكسل، و44 بكسل على شاشة اللمس. وتحت الألوان القسرية يرسم الزر حدًّا عند التمرير، ويرسم الشريط حافة بدل تعبئته.
  • الشريط القابل للإخفاء يحتاج إلى id يفرضه النوع؛ وهو أيضًا معرّف العنصر.

من اليمين إلى اليسار

الأيقونة في البداية والإجراء في النهاية، وزر الإغلاق في نهاية السطر الذي يلتف إليه، دون أي صنف فيزيائي يحتاج إلى عكس.

الخادم والمتصفح

يُعرض على الخادم، والجزء التفاعلي مكوّن متصفح لا يُرسل إلا عند استخدامه.

الملفات: index.tsx, client.tsx.

على الشارة: split - الحجم لم يُقَس بعد.