Free and open-source React tooltip components built for modern applications and websites. These tooltips are built using React Aria and styled with Tailwind CSS.
Installation
You can add this Tooltip component using our CLI or manually:
npx untitledui@latest add tooltip
Tooltip examples
Below are examples and variations of this tooltip component:
Default
Tooltips are used to display additional information when hovering over an element. This is how our tooltip component looks by default:
With arrow
You can add an arrow to the tooltip by passing the arrow boolean prop to the Tooltip component. This will add an arrow to the tooltip that points to the element being hovered over.
With supporting text
In situations where you want to provide more context for the tooltip, you can pass a description to the Tooltip component. This will display the description below the tooltip title.
Placements
Since our tooltip component is built with React Aria, it supports all the placements that React Aria supports. You can set the placement using the placement prop on the Tooltip component. To see the full list of placements, check out the tooltip props in the React Aria documentation.
API reference
Tooltip
Import Tooltip from @/components/base/tooltip/tooltip. Renders React Aria’s TooltipTrigger — all of its props are supported.
Props from React Aria Components (24)
Also accepts the global HTML attributes (dir, lang, hidden, inert, translate), all standard React DOM event handlers.
TooltipTrigger
Import TooltipTrigger from @/components/base/tooltip/tooltip. Renders React Aria’s Button — all of its props are supported.
Styling (5)
Accessibility (10)
Also accepts the global HTML attributes (dir, lang, hidden, inert, translate), all standard React DOM event handlers.
FAQs
Please refer to our frequently asked questions page for more.
Pass a focusable trigger as the child of Tooltip. The simplest option is TooltipTrigger, which renders an unstyled React Aria Button, so the tooltip opens on hover and on keyboard focus. React Aria based components like Button also work as triggers, and utility buttons have a built-in tooltip prop.
Use description to show a second line of text below the title, and set arrow to true to show an arrow pointing at the trigger. arrow is false by default.
Set the placement prop. It defaults to "top" and accepts React Aria placements such as "bottom", "left" or "top start". The tooltip sits 6px from the trigger by default; change that with offset, or shift it along the trigger with crossOffset.
Use delay to set how long to wait before opening, in milliseconds. It defaults to 300. closeDelay sets the delay before closing and defaults to 0.
Yes, pass isOpen with onOpenChange for a controlled tooltip, or defaultOpen to set the initial state. Set isDisabled to true to stop the tooltip from opening at all.
Yes, set trigger to "focus". By default the tooltip opens on both hover and focus.