Getting Started
App Providerglobal.d.tsThemesTypes
cn(...args)Text ParserUnits Converters
AnchorAvatarBreadcrumbBurgerButtonCardCarouselCheckerCodeColor PickerCommandConfettiCopyButtonDouble Helix WordsFloating IndicatorGroupHighlight TextIndicatorInputKbdLabelLoaderPaginationPassword RequirementPolymorphic SlotProgressProseRatingRunning AreaScroll AreaSheetsSkeletonSliderStackSvgTableTabsTextareaTimelineTimesToasterTooltipTyping WordsTypography
useClickOutsideuseClipboarduseDeviceInfouseDialoguseDidUpdateuseDirectionuseDisclosureuseDocumentTitleuseDocumentVisibilityuseElementInfouseEyeDropperuseFetchuseFullscreenuseGeoLocationuseHotkeysuseHoveruseIduseImagePopupuseInputStateuseIntersectionuseIntervaluseIsomorphicEffectuseListStateuseLocalStorageuseMeasureScrollbaruseMediaQueryuseMergedRefuseMouseuseMoveuseMutationObserveruseNetworkuseOpenStateuseOrientationuseOSusePaginationusePWAInstalleruseRandomColorsuseReducedMotionuseReloaduseResizeObserveruseScrollIntoViewuseStateHistoryuseTimeoutuseTouchuseTriggeruseUncontrolleduseValidatedStateuseViewportSizeuseWindowEventuseWindowScroll
Docs
Web
Components
Tooltip
Toaster

Displays transient notifications with flexible configuration options.

Typing Words

A typing animation that types and erases text based on a predefined string array.


Edit this page on GitHub
  • Started
  • Utilities
  • Configuration
  • Components
  • Hooks
  • Examples
  • Github
  • Contributing
⌘+J

© 2025 oeri rights MIT


Designed in Earth-616

Built by oeri

Tooltip

A hover- or focus-triggered popup that displays additional information or hints related to a target element.

Usage

Basic usage example to quickly see how the Tooltip works.

BB
import { Tooltip } from "@/ui/tooltip";
import { Avatar } from "@/ui/avatar";

export function TooltipDemo() {
  return (
    <Tooltip
      asChild
      side="top"
      content={<span>Brian and Brothers</span>}
      contentProps={{ className: "block" }}
      >
      <Avatar fallback="Brian and Brothers" src="https://api.dicebear.com/9.x/adventurer-neutral/svg?seed=Brian" />
    </Tooltip>
  );
}

Peer Dependencies

Install required dependencies before using the Tooltip. These libraries handle the low-level mechanics to ensure smooth performance and features.

pnpm add xuxi @radix-ui/react-tooltip
npm install xuxi @radix-ui/react-tooltip
yarn add xuxi @radix-ui/react-tooltip
bun add xuxi @radix-ui/react-tooltip

Properties

Interactive configurator to explore customization options for the Tooltip component.

Side offset
import { Tooltip } from "@/ui/tooltip";
import { Button } from "@/ui/button";
export function TooltipDemo() {
  return (
    <Tooltip
      asChild
      content="Double check the data you want to send"
      contentProps={{ className: "inline-flex" }}
    >
      <Button variant="outline" color="grape">Continue</Button>
    </Tooltip>
  );
}

Tooltip Inline

In the world of modern technology, staying updated is no longer optional—it’s a necessity. Innovations in artificial intelligence have reshaped how we interact with systems, enabling a more personalized and efficient experience. Yet, with rapid advancements come challenges. Developers must navigate the complexities of scalability, ensuring applications grow seamlessly without compromising performance. Similarly, the rise of cybersecurity concerns has pushed teams to prioritize safeguarding user data while maintaining accessibility. Every step forward in this digital age is an opportunity to create impactful solutions, but it also demands a commitment to learning, adapting, and overcoming.

import { Tooltip } from "@/ui/tooltip";

function Inline({ label }: { label: string }) {
  return (
    <Tooltip
      touch
      asChild
      side="top"
      content={`What's ${label}?`}
      className="[@media_not_all_and_(hover:hover)]:select-none"
      contentProps={{
        className: "bg-color text-background [&_[data-tooltip]]:text-color font-medium"
      }}
    >
      <mark>{label}</mark>
    </Tooltip>
  );
}

export function TooltipInlineDemo() {
  return (
    <div className="m-auto size-full max-w-lg p-6">
      <p className="w-full max-w-full text-justify text-sm">
        In the world of modern <Inline label="technology" />, staying updated is no longer optional—it’s a necessity. Innovations in <Inline label="artificial intelligence" /> have reshaped how we interact with systems, enabling a more personalized and efficient experience. Yet, with rapid advancements come challenges. Developers must navigate the complexities of <Inline label="scalability" />, ensuring applications grow seamlessly without compromising performance. Similarly, the rise of <Inline label="cybersecurity" /> concerns has pushed teams to prioritize safeguarding user data while maintaining accessibility. Every step forward in this digital age is an opportunity to create impactful solutions, but it also demands a commitment to learning, adapting, and overcoming.
      </p>
    </div>
  );
}

Anatomy

Tooltip requires a trigger as an content anchors, you can provide children strings, fragments, numbers, and several elements/components which will later be wrapped in a <button>. In contrast, when you use asChild props, use an element or component as a single child – providing strings, fragments, numbers, and multiple elements/components will cause errors.

The content property is ReactNode, its will pass children to the tooltip content. Use contentProps to change style, attributes, and pass all properties to the content body.

Alternative

You can use several ways to use Tooltip.

  1. Using with TooltipProvider and Origin/Trees Tooltip will provide full flexibility in customization.
export function MyToggle() {
  return (
    <TooltipProvider>
      <TooltipTrigger asChild>
        <button>
          <BrandGithubFillIcon className="size-5" />
        </button>
      </TooltipTrigger>
 
      <TooltipContent side="left" sideOffset={6} className="min-w-[86px]">
        <span>Lorem...</span>
      </TooltipContent>
    </TooltipProvider>
  );
}
  1. Using inline components will make your writing more concise.
  • without asChild property
export function MyToggle() {
  return (
    <Tooltip side="left" sideOffset={6} content="React.ReactNode">
      Button
    </Tooltip>
  );
}
  • with asChild property
export function MyToggle() {
  return (
    <Tooltip asChild side="left" sideOffset={6} content={<span>Lorem...</span>}>
      <a href="">
        <Icon className="size-5" />
      </a>
    </Tooltip>
  );
}
  1. Using ref in the trigger component.
export const MyToggle = React.forwardRef<React.ElementRef<"a">, React.ComponentPropsWithoutRef<"a">>((props, ref) => {
  return (
    <Tooltip asChild side="left" sideOffset={6} content={<span>Lorem...</span>}>
      <a ref={ref} href="">
        <Icon className="size-5" />
      </a>
    </Tooltip>
  );
});
MyToggle.displayName = "MyToggle";

API References

Tooltip uses @radix-ui under the hood. For a full list of supported props and advanced usage:

  • @radix-ui/react-tooltip

npmjs.com/~khoeriilham @radix-ui/react-tooltip

Styles API

Styles APITypeDefaultAnnotation
unstyled?booleanfalseif true, all default styles will be removed

Tooltip API

Props API TooltipTypeDefaultAnnotation
asChild?false-pass the triggerRef props to an element or component as a single child
content?React.ReactNodenullpass children to TooltipContent as React.ReactNode
contentProps?DetailedHTMLProps Content"div"pass all attribute TooltipContent
open?booleanfalsechange the original open and onOpenChange state with own approach
onOpenChange?(value: boolean) => void openStatechange the original open and onOpenChange state with own approach
sideOffset?number0distance between TooltipTrigger and TooltipContent
withArrow?booleanfalseadd arrow on TooltipContent
touch?booleanfalseallows TooltipContent to open when receiving a touch
align?"center" | "start" | "end""center"only available on "dropdown" variant
side?"top" | "right" | "bottom" | "left""bottom"only available on ["dropdown", "drawer"] variant

TooltipTrigger API

Props API TooltipTriggerTypeDefaultAnnotation
asChild?false-pass the triggerRef props to an element or component as a single child

Source Codes

Full working code example, including necessary markup and styles. You can copy and paste this code directly to start using the component immediately.

tooltip.tsx