Tooltip
Tooltip explains a control in a few words. It appears on hover and on keyboard focus.
import { Tooltip } from '@beyul/sulmu-ui'Examples
Section titled “Examples”Filter the list
import { FilterIcon, IconButton, Tooltip } from '@beyul/sulmu-ui'
export default function Example() { return ( <Tooltip content="Filter the list"> <IconButton aria-label="Filter" variant="secondary" icon={<FilterIcon />} /> </Tooltip> )}Placement and long text
Section titled “Placement and long text”The text wraps at 240px.
Opens on the top
Opens on the bottom
Opens on the left
Opens on the right
This dashboard is powered by reports that are created in Analytics and refreshed every night.
import { Button, Flex, Tooltip } from '@beyul/sulmu-ui'
const placements = ['top', 'bottom', 'left', 'right'] as const
export default function Example() { return ( <Flex gap={3} wrap justify="center"> {placements.map((placement) => ( <Tooltip key={placement} placement={placement} content={`Opens on the ${placement}`}> <Button variant="secondary" size="sm"> {placement} </Button> </Tooltip> ))} <Tooltip content="This dashboard is powered by reports that are created in Analytics and refreshed every night."> <Button variant="tertiary" size="sm"> Long text </Button> </Tooltip> </Flex> )}| Prop | Type | Default | Description |
|---|---|---|---|
content* | ReactNode | - | The hint. Keep it short; it wraps at 240px. |
children* | ReactElement<unknown, string | JSXElementConstructor<any>> | - | The element the hint describes. It must be focusable (a button, link or input). |
placement | "bottom" | "top" | "left" | "right" | top | Where it appears. Default: top. |
disabled | boolean | - | Whether the tooltip is disabled |
open | boolean | - | The controlled open state of the tooltip |
onOpenChange | ((details: OpenChangeDetails) => void) | - | Function called when the tooltip is opened. |
The remaining props of Ark UI’s Tooltip.Root are accepted too.
Accessibility and usage
Section titled “Accessibility and usage”- The child must be focusable (a button, link or input), or keyboard users cannot reach the hint.
- Do not put essential information in a tooltip: it is not available on touch screens.
- The tooltip opens after 300ms and closes after 100ms. Override with
openDelayandcloseDelay. - A tooltip does not replace the
aria-labelof an Icon Button.