| 5 | import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip"; |
| 6 | |
| 7 | export function HelpTooltip(props: { |
| 8 | readonly label: string; |
| 9 | readonly children: React.ReactNode; |
| 10 | readonly className?: string; |
| 11 | }) { |
| 12 | return ( |
| 13 | <TooltipProvider> |
| 14 | <Tooltip> |
| 15 | <TooltipTrigger asChild> |
| 16 | <Button |
| 17 | type="button" |
| 18 | variant="ghost" |
| 19 | size="icon-xs" |
| 20 | className="inline-flex size-4 items-center justify-center rounded-full text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring" |
| 21 | aria-label={`${props.label} help`} |
| 22 | > |
| 23 | <InfoIcon className="size-3.5" aria-hidden /> |
| 24 | </Button> |
| 25 | </TooltipTrigger> |
| 26 | <TooltipContent className={cn("w-max max-w-72 text-left text-wrap", props.className)}> |
| 27 | {props.children} |
| 28 | </TooltipContent> |
| 29 | </Tooltip> |
| 30 | </TooltipProvider> |
| 31 | ); |
| 32 | } |