Tooltip
A tooltip displays informative information when users hover over or focus on an element.
It takes a content prop, which is the content associated with the tooltip.
Events when the Tooltip opens or closes
The on_open_change event is called when the open state of the tooltip changes. It is used in conjunction with the open prop, which is passed to the event handler.
Number of times tooltip opened or closed: 0
Tooltip open: false
Hover over the button to see the tooltip.
ExpandCollapse
API Reference
rx.tooltip
Floating element that provides a control with contextual information via pointer or focus.
Props
| Prop | Type | Description |
|---|---|---|
content | str | The content of the tooltip. |
default_open | bool | The open state of the tooltip when it is initially rendered. Use when you do not need to control its open state. |
open | bool | The controlled open state of the tooltip. Must be used in conjunction with |
side | "top""right""bottom""left" | The preferred side of the trigger to render against when open. Will be reversed when collisions occur and |
side_offset | Union[float, int] | The distance in pixels from the trigger. |
align | "start""center""end" | The preferred alignment against the trigger. May change when collisions occur. |
align_offset | Union[float, int] | An offset in pixels from the "start" or "end" alignment options. |
avoid_collisions | bool | When true, overrides the side and align preferences to prevent collisions with boundary edges. |
collision_padding | Union[float, int, dict] | The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. |
arrow_padding | Union[float, int] | The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners. |
sticky | "partial""always" | The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. |
hide_when_detached | bool | Whether to hide the content when the trigger becomes fully occluded. |
delay_duration | Union[float, int] | Override the duration in milliseconds to customize the open delay for a specific tooltip. Default is 700. |
disable_hoverable_content | bool | Prevents Tooltip content from remaining open when hovering. |
force_mount | bool | Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. |
aria_label | str | By default, screenreaders will announce the content inside the component. If this is not descriptive enough, or you have content that cannot be announced, use aria-label as a more descriptive label. |