# Tooltip preview

Interactive preview of the CyberSpec Tooltip component. A small cut label that appears on hover or focus.

[View Tooltip preview on CyberSpec](https://www.cyberspec.dev/preview/tooltip)

## About this preview

Tooltip belongs to the Overlays group in the CyberSpec catalog. It uses @ui-sdk/react/tooltip.

## Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/tooltip.json
```

## Example

```tsx
"use client"

import { Crosshair, Radar, Unplug } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Tooltip } from "@/components/ui/tooltip"

export default function TooltipDemo() {
  return (
    <>
      <Tooltip content="Lock on">
        <Button icon>
          <Crosshair aria-hidden />
        </Button>
      </Tooltip>
      <Tooltip content="Sweep sector">
        <Button icon tone="signal">
          <Radar aria-hidden />
        </Button>
      </Tooltip>
      {/* A key that's off keeps its place in the tab order, so the tooltip
          can still say why. This one has a name, so the tooltip describes
          it instead of naming it. */}
      <Tooltip content="No deck linked" side="bottom">
        <Button icon disabled focusableWhenDisabled aria-label="Jack out">
          <Unplug aria-hidden />
        </Button>
      </Tooltip>
    </>
  )
}
```

## Install this example

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/tooltip-demo.json
```

## Resources

- [Tooltip documentation](https://www.cyberspec.dev/components/sidebar/tooltip.md)
- [Component catalog](https://www.cyberspec.dev/components.md)
- [Tooltip source code](https://github.com/agnelnieves/cyberspec/blob/main/registry/cyber/ui/tooltip.tsx)
- [Shadcn registry item](https://www.cyberspec.dev/r/tooltip.json)
