HextaUI

Tooltip: Disabled

A disabled button can still explain why with focusableWhenDisabled, which keeps it hoverable and in the tab order. disabled on Tooltip turns the tooltip off.

import { Button } from "@/components/ui/button"
import {
  Tooltip,
  TooltipContent,
  TooltipTrigger,
} from "@/components/ui/tooltip"

export function TooltipDisabled() {
  return (
    <div className="flex flex-wrap items-center justify-center gap-2">
      <Tooltip>
        <TooltipTrigger render={<Button disabled focusableWhenDisabled />}>
          Publish
        </TooltipTrigger>
        <TooltipContent>Add a title before publishing</TooltipContent>
      </Tooltip>
      <Tooltip disabled>
        <TooltipTrigger render={<Button variant="outline" />}>
          No tooltip
        </TooltipTrigger>
        <TooltipContent>You won’t see this</TooltipContent>
      </Tooltip>
    </div>
  )
}

This adds the example as components/examples/tooltip/disabled.tsx, together with the Tooltip component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/tooltip-disabled.json

To add only the component, follow the Tooltip installation.

Props in this example

The Tooltip props this example sets, from the API reference.

PropTypeDefault
disabledTurns the tooltip off.
booleanfalse
PropTypeDefault
render
ReactElement | (props, state) => ReactElement<button>

Every prop is in the Tooltip API reference.

See them all, with keyboard support and accessibility notes, on the Tooltip page.