1.0.3 • Published 5 months ago

react-ts-droid-tooltip v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

Tooltip

The Tooltip component is a reusable React component that displays a small tooltip when hovering over a specific element. It is inspired by the Material UI design and written in TypeScript for better type safety and maintainability.

Features

  • Clean and modern design inspired by Material UI
  • Customizable tooltip placement (top, bottom, left, right)
  • Customizable tooltip appearance (background color, text color, font size)
  • TypeScript support for type safety
  • Responsive and accessible

Installation

To use the Tooltip component in your React application, install it via npm:

npm install react-ts-droid-tooltip

Usage

To use the Tooltip component, simply import it and pass the element you want to display the tooltip for as the content prop:

import { Tooltip } from "react-ts-droid-tooltip";

<DroidTooltip title="This is a tooltip" content={<span>Hover over me</span>} />;

The title prop is required and accepts a string, a ReactNode, or a React element that will be displayed as the tooltip content.

Props

The Tooltip component accepts the following props:

PropTypeDefaultDescription
titleReactNode-The content to be displayed in the tooltip
contentReactElement-The React element that triggers the tooltip
placement'top' \| 'bottom' \| 'left' \| 'right''top'The position of the tooltip relative to the trigger element
backgroundColorstring'#333'The background color of the tooltip
textColorstring'#fff'The text color of the tooltip
fontSizestring'14px'The font size of the tooltip text

Conclusion

The Tooltip component provides a clean and modern way to display tooltips in your React application. With its customizable appearance and TypeScript support, it can easily be integrated into your project and styled to match your design requirements.

1.0.3

5 months ago