On this page

Hover card

Install, props and the parts Hover card is built from.

Install

Run this in the app, after shadcn-vue init and the Beehexa theme (Button › Code):

npx shadcn-vue@latest add https://beehexa.design/r/hover-card.json

Use

<script setup lang="ts">
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card'
</script>

<template>
  <HoverCard>
    <HoverCardTrigger as-child>
      <a href="/customers/1042">Lan Pham</a>
    </HoverCardTrigger>
    <HoverCardContent>12 orders · Customer since March 2024</HoverCardContent>
  </HoverCard>
</template>

Props

Part Prop Values Notes
HoverCard openDelay number (ms) Defaults to motion.wait.tooltip.show, read from the token
HoverCard closeDelay number (ms) 300 by default
HoverCard open, defaultOpen boolean Controlled (v-model:open) or initial state
HoverCardTrigger as-child boolean Use it, so the trigger is your link
HoverCardContent side bottom (default), top, right, left Flips when there is no room
HoverCardContent align center (default), start, end
HoverCardContent sideOffset number 4 (space.overlay.offset)
HoverCardContent class Width: size.overlay.width (288 px) by default, as Popover

Built on

Wraps the reka-ui HoverCard with the shadcn-vue HoverCard API. reka-ui gives the open and close timing, opening on focus, hovering onto the card and collision handling. Beehexa adds the styles and reads the open delay from the token instead of reka-ui’s 700 ms.

Limitations

  • Closing waits reka-ui’s 300 ms; there is no token for it yet.