Popover Card

Floating popover card with an arrow pointer, title, and helper text.

Popover title

A short helpful message that appears next to its trigger.

Tailwind CSS
<div class="relative w-full h-64 flex items-end justify-center pb-10">
  <button class="px-4 py-2 rounded-lg bg-slate-900 text-white text-sm font-medium">Show info</button>
  <div class="absolute bottom-24 w-60 max-w-[80%] rounded-xl bg-white shadow-xl border border-slate-200 p-4">
    <div class="absolute -bottom-1.5 left-1/2 -translate-x-1/2 w-3 h-3 bg-white border-b border-r border-slate-200 rotate-45"></div>
    <h4 class="font-semibold text-slate-900 text-sm mb-1">Popover title</h4>
    <p class="text-sm text-slate-600">A short helpful message that appears next to its trigger.</p>
  </div>
</div>

Free to use in personal and commercial projects. No attribution required.

Variants

Same component, different looks. Preview each one live and copy the code you like.

User card

The user card popover gives hover profiles on mentions and comment threads.

SK

Sara Khan

@sarakhan

Tailwind CSS

Dark

The dark popover stands out on light pages and matches dark interfaces.

Popover title

A short helpful message that appears next to its trigger.

Tailwind CSS

Below trigger

Show the popover below the trigger when there is no room above it.

Popover title

A short helpful message that appears next to its trigger.

Tailwind CSS

About this popover card

A popover is a small floating card that appears next to a trigger, ideal for helper text, mini forms, or extra context that does not deserve a full modal. The little arrow visually ties the card to whatever opened it, which is what separates a popover from a generic tooltip.

The card is absolutely positioned above the trigger button. The arrow is a small rotated square sharing the card's background and border colors, tucked under the bottom edge, so the two read as one continuous shape rather than two stacked elements.

Use popovers for brief, dismissible content. They should close on outside click or Escape, and the trigger needs aria-expanded so screen readers announce the open state. When the content gets long, reach for a modal instead.

Some context is too small for a modal and too rich for a tooltip: a definition, a mini form, a preview that deserves a paragraph. The popover is that middle ground, a small floating card anchored to its trigger. The little arrow is what makes it work, visually tying the card to whatever opened it so users never wonder what it belongs to.

The card is absolutely positioned above the trigger button. The arrow is a small rotated square sharing the card's background and border colors, tucked under the bottom edge so the two read as one continuous shape instead of two stacked elements. Only the two outward-facing borders show, which sells the illusion of a folded corner pointing at the trigger.

Point a small arrow at the trigger so the eye connects the card to its source; floating cards without anchors feel detached. Flip the popover above the trigger when space below runs out, and clamp it within the viewport horizontally; a card bleeding off-screen is a dead end. Dismiss on scroll for anchored popovers, since the trigger moves but the card doesn't, breaking the illusion. Keep only one popover open at a time; stacked popovers are a focus-management nightmare.

Popovers get beheaded by overflow-hidden ancestors constantly. The card renders inside a clipped container, the arrow and half the content slice off, and developers blame the positioning math. The fix is structural, not numerical: portal the popover to the document body or audit the ancestor chain for clipping contexts. If the trigger lives in a scrollable card, plan the escape route before you position anything.

Where to use it

  • ✓ Help content with titles and links
  • ✓ Date picker and filter panels
  • ✓ User profile mini cards
  • ✓ Share and more-actions menus

Customization tips

Point the arrow up, down, left, or right by moving the rotated square to that edge and keeping only the two outward-facing borders. Widen the card with w-72 for richer content, and add scale and opacity transitions for a soft entrance.

Design notes

When to use

Popovers suit small contextual content that does not deserve a modal: helper text next to a form field, a mini preview on hover, or extra details tied to one button. The little arrow visually anchors the card to its trigger, so the visitor understands what it explains. They work best for content the visitor asked for by clicking or hovering.

What to avoid

Do not put critical information only in a popover, because it disappears the moment the user clicks elsewhere. Avoid cramming forms with many fields into one, since the small card fights with validation messages. And never open several popovers at once, because overlapping floating cards are disorienting.

Accessibility

Make popovers dismissible with Escape and closable without a mouse, and use aria-describedby to associate the card with its trigger for screen readers. Do not trap focus like a modal would, since a popover is a lightweight layer, not a dialog.

Frequently asked questions

How do I move the arrow to a different side?

Move the rotated square to that edge and keep only the two borders facing outward. For a top arrow, place it at -top-1.5 with border-t and border-l instead.

Popover or tooltip, which should I use?

Tooltips are for short plain-text hints on hover. Popovers handle richer content like titles, links, and buttons, and they usually open on click rather than hover.

How do I close the popover on outside click?

Listen for clicks on the document and close when the click lands outside both the trigger and the card. Also close on Escape so keyboard users can dismiss it.

How do I make a popover work on touch devices?

Hover does not exist on touch, so add a click or tap toggle that opens and closes the card, and make sure tapping outside dismisses it. Show the popover on focus too, so keyboard users get the same content. A trigger that only responds to hover is invisible to roughly half your visitors.

What ARIA attributes does a popover need?

Give the popover role tooltip or dialog depending on whether it is read-only or interactive, and link it to the trigger with aria-describedby or aria-details. Set aria-expanded on the trigger to announce open state. Test with a screen reader to confirm the content is announced when it appears.

Should popover content be short or rich?

Match the content to the trigger: a small info icon gets one or two lines of helper text, while a user avatar can open a rich card with actions. Never hide anything essential inside a popover, since touch and keyboard users may never find it. If the content needs headings and buttons, it is a popover; if it is a label, it is a tooltip.