Tooltip Overview

The Tooltip represents a popup with information that is related to a UI element and which is displayed when this UI element is clicked or hovered over.

Basic Usage

The following example demonstrates the Tooltip in action.

import React from 'react';
import ReactDOM from 'react-dom';
import { Tooltip } from '@progress/kendo-react-tooltip';

class App extends React.Component {
    constructor(props) {
        super(props);
        this.divStyle = {
            position: 'relative',
            width: '692px',
            height: '480px',
            margin: '0 auto',
            background: "url('https://www.telerik.com/kendo-angular-ui-develop/components/tooltip/assets/" +
                    "world-map.jpg') no-repeat 0 0"
        };
        this.spanStyles = {
            cursor: 'pointer',
            position: 'absolute',
            display: 'block',
            width: '12px',
            height: '12px',
            backgroundColor: '#fff600',
            borderRadius: '30px',
            border: '0',
            boxShadow: '0 0 0 1px rgba(0,0,0,0.5)',
            transition: 'box-shadow .3s',
            zIndex: '10'
        };
        this.stylesCanton = {
            top: '226px',
            left: '501px'
        };
        this.stylesJakarta = {
            top: '266px',
            left: '494px'
        };
        this.stylesMexico = {
            top: '227px',
            left: '182px'
        };
        this.stylesDelhi = {
            top: '214px',
            left: '448px'
        };
        this.stylesKarachi = {
            top: '222px',
            left: '431px'
        };
        this.stylesNewyork = {
            top: '188px',
            left: '214px'
        };
        this.stylesSaopaolo = {
            top: '304px',
            left: '248px'
        };
        this.stylesBombay = {
            top: '233px',
            left: '438px'
        };
        this.stylesLosangeles = {
            top: '202px',
            left: '148px'
        };
        this.stylesOsaka = {
            top: '201px',
            left: '535px'
        };
        this.stylesMoscow = {
            top: '153px',
            left: '402px'
        };
    }

    render() {
        return (
            <Tooltip anchorElement="target" position="top">
                <div id="agglomerations" style={this.divStyle}>
                    <a
                        style={{
                            ...this.spanStyles,
                            ...this.stylesCanton
                        }}
                        href="#"
                        title="Canton - 26,300,000"
                        id="canton"></a>
                    <a
                        style={{
                            ...this.spanStyles,
                            ...this.stylesJakarta
                        }}
                        title="Jakarta - 25,800,000"
                        id="jakarta"></a>
                    <a
                        style={{
                            ...this.spanStyles,
                            ...this.stylesMexico
                        }}
                        title="Mexico City - 23,500,000"
                        id="mexico"></a>
                    <a
                        style={{
                            ...this.spanStyles,
                            ...this.stylesDelhi
                        }}
                        title="Delhi - 23,500,000"
                        id="delhi"></a>
                    <a
                        style={{
                            ...this.spanStyles,
                            ...this.stylesKarachi
                        }}
                        title="Karachi - 22,100,000"
                        id="karachi"></a>
                    <a
                        style={{
                            ...this.spanStyles,
                            ...this.stylesNewyork
                        }}
                        title="New York - 21,500,000"
                        id="newyork"></a>
                    <a
                        style={{
                            ...this.spanStyles,
                            ...this.stylesSaopaolo
                        }}
                        title="Sao Paulo - 21,300,000"
                        id="saopaolo"></a>
                    <a
                        style={{
                            ...this.spanStyles,
                            ...this.stylesBombay
                        }}
                        title="Mumbay/Bombay - 21,100,000"
                        id="bombay"></a>
                    <a
                        style={{
                            ...this.spanStyles,
                            ...this.stylesLosangeles
                        }}
                        title="Los Angeles - 17,100,000"
                        id="losangeles"></a>
                    <a
                        style={{
                            ...this.spanStyles,
                            ...this.stylesOsaka
                        }}
                        title="Osaka - 16,800,000"
                        id="osaka"></a>
                    <a
                        style={{
                            ...this.spanStyles,
                            ...this.stylesMoscow
                        }}
                        title="Moscow - 16,200,000"
                        id="moscow"></a>
                </div>
            </Tooltip>
        );
    }
}
ReactDOM.render(
    <App/>, document.querySelector('my-app')
);

Installation

  1. Download and install the package. Use Node.js v5.0.0 or later.

    npm install --save @progress/kendo-react-tooltip
  2. Once installed, import the package module.

    // ES2015 module syntax
    import { Tooltip } from '@progress/kendo-react-tooltip';
    // CommonJS format
    const { Tooltip } = require('@progress/kendo-react-tooltip');
  3. You are required to install one of the Kendo UI themes to style your components. For more information on how to add the styles, refer to the article on getting started.

Dependencies

The Tooltip package requires the following peer dependencies that have to be installed by your application:

  • react
  • react-dom

Functionality and Features

In this article