Hover card

Hover Card

A card that appears when a user hovers over an element.


import { MapPinIcon } from 'lucide-react'
import { HStack, Stack } from 'styled-system/jsx'
import { Avatar, Link } from '~/components/ui'
import * as HoverCard from '~/components/ui/hover-card'
import { Icon } from '~/components/ui/icon'
import { Text } from '~/components/ui/text'

export const Demo = (props: HoverCard.RootProps) => {
  return (
    <HoverCard.Root {...props}>
      <HoverCard.Trigger asChild>
        <Link href="">@grizzly_codes</Link>

            <HoverCard.ArrowTip />
          <Stack gap="4" direction="row">
              name="Christian Schröter"
            <Stack gap="3">
              <Stack gap="1">
                <Text size="sm" fontWeight="semibold">
                <Text size="sm" color="fg.muted">
                  Staff Software Engineer working at vivenu GmbH
              <HStack gap="1" color="fg.subtle">
                <Icon size="sm">
                  <MapPinIcon />
                <Text size="xs">Joined Dezember 2011</Text>



Add Component

Insert code snippet into your project. Update import paths as needed.

import { HoverCard } from '@ark-ui/react/hover-card'
import type { ComponentProps } from 'react'
import { styled } from 'styled-system/jsx'
import { hoverCard } from 'styled-system/recipes'
import { createStyleContext } from '~/lib/create-style-context'

const { withProvider, withContext } = createStyleContext(hoverCard)

export const Root = withProvider(HoverCard.Root)
export const Arrow = withContext(styled(HoverCard.Arrow), 'arrow')
export const ArrowTip = withContext(styled(HoverCard.ArrowTip), 'arrowTip')
export const Content = withContext(styled(HoverCard.Content), 'content')
export const Positioner = withContext(styled(HoverCard.Positioner), 'positioner')
export const Trigger = withContext(styled(HoverCard.Trigger), 'trigger')

export interface RootProps extends ComponentProps<typeof Root> {}
export interface ArrowProps extends ComponentProps<typeof Arrow> {}
export interface ArrowTipProps extends ComponentProps<typeof ArrowTip> {}
export interface ContentProps extends ComponentProps<typeof Content> {}
export interface PositionerProps extends ComponentProps<typeof Positioner> {}
export interface TriggerProps extends ComponentProps<typeof Trigger> {}

Add Recipe

This step is necessary only if you do not use any of the Park UI plugins.

import { hoverCardAnatomy } from '@ark-ui/anatomy'
import { defineSlotRecipe } from '@pandacss/dev'

export const hoverCard = defineSlotRecipe({
  className: 'hoverCard',
  slots: hoverCardAnatomy.keys(),
  base: {
    content: {
      '--hover-card-background': '',
      background: 'var(--hover-card-background)',
      borderRadius: 'l3',
      boxShadow: 'lg',
      maxW: '80',
      p: '4',
      position: 'relative',
      _open: {
        animation: 'fadeIn 0.25s ease-out',
      _closed: {
        animation: 'fadeOut 0.2s ease-out',
    arrow: {
      '--arrow-size': '12px',
      '--arrow-background': 'var(--hover-card-background)',
    arrowTip: {
      borderTopWidth: '1px',
      borderLeftWidth: '1px',

On this page