تلميح

Tooltip

تلميح متاح الوصول في React مبني على Radix يظهر عند التمرير والتركيز، مع مشغّل HelpIcon ونمط بعنوان وأيقونة وسطح معكوس. جاهز للاتجاه العربي.

لف المشغل بـ TooltipTrigger asChild وضع الرسالة في TooltipContent. ويجمع HelpIcon مشغل "?" جاهزًا مع تلميحه.

متى تستخدمه

استخدم Tooltip لتلميح قصير يوضّح زر أيقونة أو تسمية حقل، مثل معنى رقم مرجعي. استخدم HelpIcon بجانب تسميات النماذج لمشغّل «?» جاهز.

لا تضع التعليمات الأساسية في تلميح؛ فهو مخفي افتراضيًا وغير متاح باللمس. استخدم helperText في الحقل بدلًا منه.

أمثلة

أساسي

العنوان والأيقونة وسطح معكوس

أيقونة مساعدة

العربية (RTL)

الخصائص

الخصائص التي يعرّفها Tooltip. سمات العنصر الأصلي تمرّ كما هي.

<Tooltip>

الخاصيةالنوعالافتراضيالوصف
childrenReactNode
openboolean
defaultOpenboolean
onOpenChange(open: boolean) => void
delayDurationnumber700The duration from when the pointer enters the trigger until the tooltip gets opened. This will override the prop with the same name passed to Provider.
disableHoverableContentbooleanfalseWhen true, trying to hover the content will result in the tooltip closing as the pointer leaves the trigger.

<TooltipTrigger>

الخاصيةالنوعالافتراضيالوصف
asChildboolean

<TooltipContent>

الخاصيةالنوعالافتراضيالوصف
invertedbooleanDark surface (gray-800) instead of the default light card. Mirrors SDGA Inverted.
titlereact.ReactNodeBold heading shown above the body text.
iconreact.ReactNodeLeading help badge: true renders the SDGA "?" help-circle, or pass your own node.
arrowbooleanShow the beak pointing at the trigger. Defaults to true.
side"top" | "right" | "bottom" | "left"
sideOffsetnumber
align"center" | "start" | "end"
alignOffsetnumber
arrowPaddingnumber
avoidCollisionsboolean
collisionBoundaryElement | Element[]
collisionPaddingnumber | Partial<Record<"top" | "right" | "bottom" | "left", number>>
sticky"always" | "partial"
hideWhenDetachedboolean
updatePositionStrategy"always" | "optimized"
forceMounttrueUsed to force mounting when more control is needed. Useful when controlling animation with React animation libraries.
aria-labelstringA more descriptive label for accessibility purpose
onEscapeKeyDown(event: KeyboardEvent) => voidEvent handler called when the escape key is down. Can be prevented.
onPointerDownOutside(event: PointerDownOutsideEvent) => voidEvent handler called when the a pointerdown event happens outside of the Tooltip. Can be prevented.

إمكانية الوصول

يفتح التلميح عند التمرير وعند التركيز بلوحة المفاتيح، ويغلقه Escape. يربط Radix المحتوى بالمشغّل، فيقرأ قارئ الشاشة التلميح عند التركيز على المشغّل.

يجب أن يكون المشغّل نفسه قابلًا للتركيز، فغلّف زرًّا أو رابطًا بـ TooltipTrigger asChild. أبقِ النص قصيرًا؛ فالتلميحات ليست للفقرات.