import type { TooltipContentProps, TooltipPortalProps, TooltipProps as RootProps, } from '@radix-ui/react-tooltip'; import * as TooltipPrimitive from '@radix-ui/react-tooltip'; import type { ReactElement, ReactNode } from 'react'; import * as styles from './styles.css'; export interface TooltipProps { // `children` can not be string, number or even undefined children: ReactElement; content?: ReactNode; side?: TooltipContentProps['side']; align?: TooltipContentProps['align']; rootOptions?: Omit; portalOptions?: TooltipPortalProps; options?: Omit; } export const Tooltip = ({ children, content, side = 'top', align = 'center', options, rootOptions, portalOptions, }: TooltipProps) => { if (!content) { return children; } return ( {children} {content} ); };