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/tooltip.json
Tooltip also ships in @beehexa/vue-components (@beehexa/vue-components/tooltip) from the next release.
Use
Put one TooltipProvider around the app, or around a group of triggers, so waits are shared.
<script setup lang="ts">
import { Trash2 } from '@lucide/vue'
import { Button } from '@/components/ui/button'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
</script>
<template>
<TooltipProvider>
<Tooltip relationship="label">
<TooltipTrigger as-child>
<Button variant="ghost-destructive" size="icon"><Trash2 /></Button>
</TooltipTrigger>
<TooltipContent>Delete mapping</TooltipContent>
</Tooltip>
</TooltipProvider>
</template>
Props
| Part | Prop | Values | Notes |
|---|---|---|---|
Tooltip |
relationship |
description (default), label |
label makes the text the trigger’s name (aria-labelledby); description adds it after the name (aria-describedby) |
Tooltip |
open, defaultOpen |
boolean | Controlled or initial state |
TooltipTrigger |
as-child |
boolean | Use it, so the trigger is your button or link, not an extra element |
TooltipContent |
side |
top (default), right, bottom, left |
Flips when there is no room |
TooltipContent |
align |
center (default), start, end |
|
TooltipContent |
sideOffset |
number | 8 (space.100). Keep it: 4 touches the focus ring |
TooltipProvider |
delayDuration |
number (ms) | Defaults to motion.wait.tooltip.show, read from the token |
TooltipProvider |
skipDelayDuration |
number (ms) | Time in which the next tooltip shows at once. Same default |
Built on
Wraps the reka-ui Tooltip with the shadcn-vue Tooltip API. reka-ui gives role="tooltip", focus and Esc handling, hover onto the tooltip and collision handling. Beehexa adds the styles, the token-based wait and relationship.
Limitations
- The tooltip appears and leaves without the motion tokens (
motion.overlay.enter,.exit) for now. - Hiding waits no time;
motion.wait.tooltip.hide(100 ms) is not applied yet.