import { Tooltip } from '@concur/nui-widgets';
A tooltip is a lightweight overlay that contains a short message which provides the user context about an unknown or unfamiliar element in an interface.
Tooltips are displayed automatically when users hover over (on mouseover) or place focus on a graphical element, such as an icon, image, hyperlink, or form input. They automatically hide when the user moves the mouse (on mouseout) or when focus (blur event) is moved to another element on the page.
Use tooltips:
Avoid using tooltips:
Tooltips can be used with different components, as shown below. Hover over each element to reveal the tooltip.
<Tooltip
message='This is a tooltip'
placement='bottom'>
<i className='icon-hotel icon-size-lg' />
</Tooltip>
<Tooltip
message='This is a tooltip'
placement='right'>
<Button>Button</Button>
</Tooltip>
<Tooltip
message='This is a tooltip'
placement='left'>
<Button type='link'>Click Here</Button>
</Tooltip>
<Tooltip
message='This is a tooltip'
placement='top'>
<FormControl />
</Tooltip>
Property | Type | Default | Description |
---|---|---|---|
children | Node | Required | React component to which the tooltip will be attached. |
message | String | Required | Text to display in the tooltip. |
placement | String | 'right' | Placement of the tooltip relative to the children element. Options are 'top' , 'bottom' , 'left' , 'right' . |
Showing a tooltip on hover or when keyboard focus is placed on a focusable element ensures that all users can access it, even if they aren’t using a mouse.
By default, CoreUI components help assistive technology read the tooltip content by building the following into the default component: