Tooltip
Cardan UI offers a <Tooltip /> component for toggletips with static content.
A common pattern on the web is to show content on top of other content, drawing the user's attention to specific important information or actions that need to be taken. This pattern can technically be described as a non-modal dialog or popover. Cardan UI uses the and for the Tooltip and Popover components.
A Tooltip is a popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it. Cardan UI uses instead. Toggletips are revealed by click rather than by hover and focus. This pattern is more consistent across touch, mouse and keyboard controls.
Note: the is work in progress; it does not yet have task force consensus.
Cardan UI offers a <Tooltip /> component for toggletips with static content.
button element to trigger the toggletip.aria-expanded attribute. The value should align with the open state of the toggletip. popovertarget attribute, the browser automatically conveys and updates the expanded/collapsed state. aria-controls attribute. The value should refer to the ID of the toggletip. popovertarget attribute establishes the relationship (an implicit aria-details) between the trigger and the toggletip. role="tooltip". role="tooltip" attribute is not applicable since we are using role="status" for the live region. Cardan UI offers a <Popover /> component for interactive toggletips that can contain links or buttons.
The Popover component is an interative toggletip without a live region. When the hidden menu appears, focus will be moved to the first menu item.
button element to open or close the menu. aria-controls attribute. The value should refer to the ID of the menu. aria-expanded attribute. The value should align with the open state of the toggletip. popovertarget attribute, the browser will automatically convey whether the popover is expanded or collapsed.