Tooltip preview

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

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.

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

Example

"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

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

Resources

View as Markdown