Files
zeekay 464e1eece0 State a version once
A version written into a manifest is written into every manifest that wants it,
which is how eslint came to exist in a hundred and four forms across this estate
and how a package came to resolve twice at run time. The catalog moves the number
out of the manifest: a manifest names the package, the workspace names the
version.

Four are held below their latest because the newer release cannot be used, and
the reason is recorded rather than the version alone: @noble/hashes 2 renamed
every subpath the web3 stack imports, @splinetool/runtime 2 depends on a package
that was never published, @dynamic-labs 5.4.1 the same, and react-resizable-panels
3 points its types condition at the bundle.
2026-09-15 11:45:32 -07:00

147 lines
3.4 KiB
Plaintext

import { Meta, Controls, Primary } from '@storybook/addon-docs/blocks';
import * as TooltipStories from './tooltip.stories';
import * as TooltipSimpleStories from './tooltip-simple.stories';
import * as TooltipProviderStories from './tooltip-provider.stories';
import * as TooltipTriggerStories from './tooltip-trigger.stories';
import * as TooltipContentStories from './tooltip-content.stories';
<Meta of={TooltipStories} />
# Tooltip
A customizable tooltip component with smooth animations and flexible positioning.
## How to use
### TooltipSimple (preset)
Minimal preset that wraps a trigger element and shows a tooltip on hover. Handles all the composition internally.
**Basic usage:**
```tsx
import { TooltipSimple, TooltipProvider } from '@signozhq/ui';
import { Button } from '@signozhq/ui';
export default function MyComponent() {
return (
<TooltipProvider delayDuration={700}>
<TooltipSimple title="Helpful information" arrow>
<Button variant="solid" color="secondary">
Hover me
</Button>
</TooltipSimple>
</TooltipProvider>
);
}
```
**With positioning:**
```tsx
<TooltipSimple title="I appear on the right" side="right" align="start">
<Button>Hover me</Button>
</TooltipSimple>
```
**Inside a modal/dialog (no portal):**
When placing a tooltip inside a modal or dialog, set `withPortal={false}` so the tooltip content stays within the modal DOM instead of portaling to `document.body`. This avoids z-index and stacking issues.
```tsx
import { Dialog, DialogContent, TooltipSimple, Button } from '@signozhq/ui';
<Dialog>
<DialogContent>
<TooltipSimple title="Inside modal" withPortal={false}>
<Button>Hover me</Button>
</TooltipSimple>
</DialogContent>
</Dialog>
```
**With extra content props:**
```tsx
<TooltipSimple
title="Custom"
tooltipContentProps={{ className: 'custom-class', arrowPadding: 8 }}
>
<Button>Hover me</Button>
</TooltipSimple>
```
Set `delayDuration={0}` in Storybook for instant feedback.
<Primary />
## TooltipSimple Props
<Controls of={TooltipSimpleStories.Default} />
## TooltipProvider Props
<Controls of={TooltipProviderStories.Default} />
## Primitive composition
For custom content and positioning, use `TooltipRoot`, `TooltipTrigger`, and `TooltipContent`:
```tsx
import { TooltipRoot, TooltipTrigger, TooltipContent, TooltipProvider } from '@signozhq/ui';
import { Button } from '@signozhq/ui';
export default function MyComponent() {
return (
<TooltipProvider>
<TooltipRoot>
<TooltipTrigger asChild>
<Button>Custom content</Button>
</TooltipTrigger>
<TooltipContent side="bottom" arrow>
<span style={{ fontWeight: 500 }}>Custom tooltip</span>
<br />
<span style={{ fontSize: 14, lineHeight: 1.42857, opacity: 0.9 }}>With multiple lines</span>
</TooltipContent>
</TooltipRoot>
</TooltipProvider>
);
}
```
**Inside a modal (no portal):**
```tsx
import {
Dialog,
DialogContent,
TooltipRoot,
TooltipTrigger,
TooltipContent,
TooltipProvider,
} from '@signozhq/ui';
<Dialog>
<DialogContent>
<TooltipProvider>
<TooltipRoot>
<TooltipTrigger asChild>
<Button>Hover me</Button>
</TooltipTrigger>
<TooltipContent side="top" withPortal={false}>
Tooltip inside modal
</TooltipContent>
</TooltipRoot>
</TooltipProvider>
</DialogContent>
</Dialog>
```
## TooltipTrigger Props
<Controls of={TooltipTriggerStories.Default} />
## TooltipContent Props
<Controls of={TooltipContentStories.Default} />