Display UI

Tooltip

Provides brief contextual information or hints when hovering or focusing on an element.

I am a tooltip!

Installation

npx shadcn@latest add https://display-ui.vercel.app/r/Tooltip

Usage

import { Button } from "@/registry/default/displayui/Button"
import { Tooltip } from "@/registry/default/displayui/Tooltip"
<Tooltip.Root>
  <Tooltip.Trigger>
    <Button>Hover me</Button>
  </Tooltip.Trigger>
  <Tooltip.Content content="I am a tooltip!" position="simple" />
</Tooltip.Root>

API

Tooltip Props

For Tooltip Root

AttributeTypeDescriptionDefault
childrenReactNode | ReactNode[]Wraps the tooltip trigger and content. Provides the hover group context required for tooltip visibility.-
classNamestringAdditional CSS classes to customize the tooltip root container styling.-

For Tooltip Trigger

AttributeTypeDescriptionDefault
childrenReactNodeElement that triggers the tooltip on hover.-
classNamestringAdditional CSS classes to customize the tooltip trigger styling.-

For Tooltip Content

AttributeTypeDescriptionDefault
contentReactNodeContent displayed inside the tooltip.-
position"top" | "bottom" | "left" | "right" | "simple"Controls the placement of the tooltip relative to the trigger."top"
classNamestringAdditional CSS classes to customize the tooltip content styling.-

Examples

Simple

Loading...

Top

Loading...

Bottom

Loading...

Left

Loading...
Loading...

Credits

This component is inspired by Rehman Kalawant Design Shared On Github.

On this page