Skip to content
synccn

Tooltip

Label on hover and focus, on any side.

Playground

Change the props and copy the code. The controls come from the component's TypeScript types.

Props

side
delay250
import { Tooltip } from "@/components/ui/tooltip";<Tooltip content="Bold (⌘B)"><Button variant="outline">Hover or focus me</Button></Tooltip>

Installation

$ pnpm dlx shadcn@latest add @synccn/tooltip

First time in this project? Connect synccn with one command.

Usage

import { Tooltip } from "@/components/ui/tooltip";<Tooltip content="Bold"><button>B</button></Tooltip>

API reference

Generated from the component's TypeScript types, so it always matches the code.

Tooltip

Shows on hover and keyboard focus after a short delay.

  • contentrequired
    React.ReactNode

    Tooltip text.

  • side
    "top" | "bottom" | "left" | "right"

    Default "top"

    Where it appears.

  • delay
    number

    Default 250

    Milliseconds before showing.

  • children
    React.ReactNode

    Content to render.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

npm packages

Used by

Keyboard

  • TabFocusing the trigger shows the tooltip
  • EscHide it

Accessibility

  • Shown on hover and on focus. Don't put essential information or interactive content in a tooltip.

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA roles: tooltip
  • ARIA attributes: aria-describedby
  • Keys handled: Escape