Tooltip

A Tooltip component is a small, informative pop-up that appears when a user hovers over or focuses on an element, such as a button or icon. It provides additional context or explanations about that element without cluttering the interface. Tooltips enhance user experience by offering helpful hints, instructions, or details, ensuring that information is accessible without overwhelming the layout.

Demo

Rendered live, with the same build of the library you install.

Usage

Tooltip.tsx
import { NButton, NTooltip } from '@nayan-ui/react';
const Tooltip = () => {
return (
<div>
<NTooltip message="This is a tooltip!">
<NButton>Hover me</NButton>
</NTooltip>
</div>
);
};
export default Tooltip;

Attributes

11 props
NameTypeDefaultDetails
messageReact.ReactNodeRequiredTooltip message or content.
classNamestring' 'You can customise by passing tailwind classes.
triggerClassNamestring' 'You can customise by passing tailwind classes.
childrenReact.ReactNodeRequiredTooltip trigger content.
placement'top' | 'bottom' | 'left' | 'right'OptionalPlacement of the tooltip.
delayShownumberOptionalDelay in ms before showing.
delayHidenumberOptionalDelay in ms before hiding.
idstringOptionalID for accessibility.
ariaLabelstringOptionalARIA label for accessibility.
triggerPropsReact.HTMLAttributes<HTMLElement>OptionalProps for trigger element.
contentPropsReact.HTMLAttributes<HTMLDivElement>OptionalProps for content element.

Tags

Other components solving nearby problems.