الانتقال إلى المحتوى الرئيسي

نظرة عامة

ينسّق Banner المحتوى الذي يوفّره المستدعي، وعقدة icon اختيارية وعقدة action اختيارية. تصف status معنى الملاحظات: neutral أو info أو success أو warning أو error. تحدد variant المظهر solid أو soft. تتجاوز color الصريحة لوحة ألوان الحالة دون تغيير معناها. القيم الافتراضية هي status="info" وvariant="solid". لوحات ألوان الحالة الافتراضية هي الرمادي والأزرق والأخضر والبرتقالي والأحمر، على الترتيب.

استخدام

الإجراءات والمظهر

يوفر Banner.Action زرًا صغيرًا بإطار يرث اللون المعروض للشعار، بما في ذلك تجاوزات لوحة الألوان الصريحة والمظاهر الصلبة. وهو يدعم تفاعلات Button والروابط وrefs والعرض المخصص. تقبل خانة action أيضًا عناصر تحكم عشوائية. الهدف الجذري هو div. تنطبق السمات الأصلية ومعالجات الأحداث وclassName وstyle وref على ذلك الجذر. يقبل render عنصر Base UI أو دالة رد نداء؛ وتتلقى دالة رد النداء الخصائص الأصلية وref، بالإضافة إلى حالة status وvariant وcolor المحلولة. حافظ على الخصائص وref المزوّدين عند تكوين عنصر آخر.
لا تعيّن الحالة تلقائيًا role أو aria-live أو الإعلانات. اخترها لدى المستدعي عندما ينبغي الإعلان عن التحديثات. وفّر أسماء يمكن الوصول إليها لعناصر التحكم، وعلّم عقد الأيقونات الزخرفية باستخدام aria-hidden. يتحكم المستدعي في الرؤية والإغلاق.

الإغلاق

مرّر onDismiss لعرض عنصر تحكم إغلاق شفاف بحجم 24px عند النهاية المنطقية للسطر. يرث عنصر التحكم لون اللافتة ويتضمن type="button". القيمة الافتراضية لـ closeLabel هي Close؛ وفّر نصًا مترجمًا في تطبيقك. تحافظ المسافات المتوازنة ضمن السطر على وضوح المحتوى والإجراءات المتمركزة بعيدًا عن عنصر التحكم. يتولى المستدعي التحكم في الظهور. يؤدي تفعيل عنصر التحكم بالإغلاق إلى استدعاء onDismiss ويُبقي اللافتة مركّبة حتى يُحدّث مستدعيها الحالة. تبقى الإجراءات الأخرى في خانة action.

الترحيل

استبدل variant="primary" بـ variant="solid" وvariant="secondary" بـ variant="soft". استبدل color="danger" بـ status="error"، أو بـ color="red" عندما ينبغي تغيير لوحة الألوان فقط. يمكن لشعارات المعلومات الزرقاء استخدام status="info".

الخصائص

ReactNode
Optional trailing ReactNode. Banner.Action supplies a small outline action that inherits the resolved banner color; arbitrary controls are also accepted.
ReactNode
Caller-provided content, including text, links and controls.
string
Class merged onto the root div or composed element.
string
افتراضي:"Close"
Accessible label for the close control. Defaults to Close; supply localized text when needed.
"blue" | "gray" | "green" | "orange" | "red"
افتراضي:"status palette"
Palette override: gray, blue, green, orange or red. When omitted, status selects the corresponding palette.
ReactNode
Optional leading ReactNode. The caller supplies decorative or accessible icon semantics.
(() => void)
Renders a 24px ghost close control and calls this callback when activated. The caller owns visibility.
Ref<HTMLDivElement>
Ref to the root div, or to the DOM element supplied through render.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, BannerState>
Base UI element or render callback. The callback receives native props/ref and resolved status, variant and color state.
"error" | "info" | "neutral" | "success" | "warning"
افتراضي:"info"
Feedback meaning: neutral, info, success, warning or error. Defaults to info. Does not assign a role or live region.
CSSProperties
Inline styles applied to the root div or composed element.
"soft" | "solid"
افتراضي:"solid"
Solid or soft appearance. Defaults to solid, independently of status.
string | ((state: ButtonState) => string | undefined)
CSS class applied to the element, or a function that returns a class based on the component’s state.
boolean
Adds a shadow and backdrop blur. Neutral outline buttons also use elevated surface colors.
ReactNode
Decorative content displayed after the label.
boolean
افتراضي:"false"
Whether the button should be focusable when disabled.
boolean
Expands the button to fill its container width.
string
Destination URL. Renders a native anchor when render is omitted unless nativeButton is explicitly true. Custom renderers retain their own element contract.
boolean
Shows a loading indicator and disables activation.
"center" | "end" | "start"
Where the loading indicator appears. center hides the content while preserving its layout space; start and end keep children and the opposite icon visible and replace the corresponding icon with the spinner.
boolean
افتراضي:"true"
Whether the rendered root is a native button. Defaults to true for custom renderers. The built-in href anchor defaults to false; an explicit value takes precedence.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ButtonState>
Caller-supplied root element or renderer. Native attributes, handlers, event details, and refs reach the rendered root. Use nativeButton={false} and role="link" for a custom navigation anchor. Router integration belongs to the caller.
AriaRole
Role of the root element. Use link for custom navigation renderers.
ShortcutDefinition
Flat key array for simultaneous keys, or nested key arrays for an ordered sequence. Displayed on non-mobile screens.
string
Localized text between sequence steps. Defaults to then.
ReactNode
Decorative content displayed before the label.
CSSProperties | ((state: ButtonState) => CSSProperties | undefined)
Style applied to the element, or a function that returns a style object based on the component’s state.