> For the complete documentation index, see [llms.txt](https://docs.usegravity.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.usegravity.app/gravity-web/components/tooltip.md).

# Tooltip

The `Tooltip` component provides a popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.

### Preview

<div align="left"><figure><img src="/files/M68xqV0jOp2vDn0zzi7u" alt="Gravity tooltip component" width="135"><figcaption></figcaption></figure></div>

### Usage

```javascript
import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from 'components/lib';

function MyComponent({ ...props }){
  return (
    <TooltipProvider>
      <Tooltip>
      
        <TooltipTrigger asChild>
          <button>Hover me</button>
        </TooltipTrigger>
        
        <TooltipContent>
          Tooltip content goes here
        </TooltipContent>
        
      </Tooltip>
    </TooltipProvider>
  );
}
```

### Props

| Prop       | Description                            | Required | Value                |
| ---------- | -------------------------------------- | -------- | -------------------- |
| className  | custom styling                         | optional | SCSS or Tailwind     |
| children   | component(s) to wrap within tooltip    | optional | component(s)         |
| sideOffset | offset of the tooltip from the trigger | optional | integer (default: 4) |

### Notes

* The `Tooltip` component uses `TooltipPrimitive` from `@radix-ui/react-tooltip` for tooltip functionality.
* The `className` prop allows for custom styling to be applied.
* The `children` prop is required and should include the trigger and content for the tooltip.
* The `sideOffset` prop specifies the offset of the tooltip from the trigger and defaults to 4.
* For more details, refer to the [Shadcn Tooltip documentation](https://ui.shadcn.com/docs/components/tooltip).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.usegravity.app/gravity-web/components/tooltip.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
