npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@chainplatform/tooltip

v0.0.1

Published

Reusable tooltip component for React Native / React Native Web.

Readme

@chainplatform/tooltip

Modern tooltip component for React Native / React Native Web.

GitHub stars
GitHub forks

Reusable tooltip component for React Native and React Native Web.

This package is designed for buttons, icons, labels, table actions, chart labels, list actions, and small UI elements that need a clean tooltip on both mobile and web.


Features

  • React Native support
  • React Native Web support
  • Web hover support
  • Mobile press support
  • Manual trigger support
  • Auto placement
  • Top / bottom placement
  • Prevent screen overflow
  • Click outside to close on mobile
  • Web hover close using global mousemove
  • Does not block button click on web
  • Works inside small containers
  • Works inside table rows, cards, and views with limited size
  • Custom content support
  • Dark modern UI
  • Arrow indicator
  • Shadow and border style
  • Built with class component
  • Uses Modal to avoid parent clipping

Install

npm install @chainplatform/tooltip prop-types @chainplatform/layout --save

or:

yarn add @chainplatform/tooltip prop-types @chainplatform/layout

Basic Usage

import React from 'react';
import { Text } from 'react-native';
import Tooltip from '@chainplatform/tooltip';

export default function Example() {
    return (
        <Tooltip
            title="Information"
            text="This is a tooltip component"
        >
            <Text>Hover me</Text>
        </Tooltip>
    );
}

Web Hover / Mobile Press

By default, trigger="auto" is used.

Web    => hover
Mobile => press
<Tooltip
    title="Skill"
    text="Listening skill"
>
    <Text>Listening</Text>
</Tooltip>

Same as:

<Tooltip
    trigger="auto"
    title="Skill"
    text="Listening skill"
>
    <Text>Listening</Text>
</Tooltip>

Tooltip With Title, Text And Value

<Tooltip
    title="GPA"
    text="Điểm trung bình học tập"
    value="8.5 / 10"
>
    <Text>GPA</Text>
</Tooltip>

Tooltip With Icon

import Tooltip from '@chainplatform/tooltip';
import EditSVG from './EditSVG';

<Tooltip
    title="Edit"
    text="Edit this item"
    value="Active"
>
    <EditSVG width={20} color="#2563EB" />
</Tooltip>

Tooltip With Custom Color Dot

<Tooltip
    title="Passed"
    text="Student passed this exam"
    value="70%"
    color="#10B981"
>
    <Text>Status</Text>
</Tooltip>

Custom Content

Use content when you need a fully custom tooltip body.

import React from 'react';
import { Text, View } from 'react-native';
import Tooltip from '@chainplatform/tooltip';

<Tooltip
    content={
        <View>
            <Text
                style={{
                    color: '#FFFFFF',
                    fontWeight: '700',
                    marginBottom: 4,
                }}
            >
                Student A
            </Text>

            <Text
                style={{
                    color: '#D1D5DB',
                    fontSize: 12,
                }}
            >
                Average score: 8.7
            </Text>
        </View>
    }
>
    <Text>Profile</Text>
</Tooltip>

Placement

Auto Placement

placement="auto" chooses top or bottom based on available screen space.

<Tooltip
    placement="auto"
    title="Auto Tooltip"
    text="Tooltip will choose the best position"
>
    <Text>Auto</Text>
</Tooltip>

Top Placement

<Tooltip
    placement="top"
    title="Top Tooltip"
>
    <Text>Top</Text>
</Tooltip>

Bottom Placement

<Tooltip
    placement="bottom"
    title="Bottom Tooltip"
>
    <Text>Bottom</Text>
</Tooltip>

Trigger Types

auto

<Tooltip trigger="auto" />

Behavior:

Web    => onMouseEnter
Mobile => onPress

hover

<Tooltip
    trigger="hover"
    title="Hover only"
>
    <Text>Hover</Text>
</Tooltip>

hover is only active on web.


press

<Tooltip
    trigger="press"
    title="Press tooltip"
>
    <Text>Press</Text>
</Tooltip>

press works by pressing the child element.


manual

Use manual when the parent controls the tooltip.

This is recommended when the tooltip is inside a parent Pressable.

<Tooltip
    ref={tooltipRef}
    trigger="manual"
    title="Manual Tooltip"
>
    <Text>Manual</Text>
</Tooltip>

Methods

When using ref, the tooltip exposes these methods:

show

tooltipRef.current?.show();

hide

tooltipRef.current?.hide();

toggle

tooltipRef.current?.toggle();

Tooltip Inside Parent Pressable

When the tooltip is inside a parent Pressable, use trigger="manual" so the parent press behavior is preserved.

import React from 'react';
import { Pressable } from 'react-native';
import Tooltip from '@chainplatform/tooltip';
import EditSVG from './EditSVG';

export default class Example extends React.PureComponent {

    tooltipRef = React.createRef();

    onPress = () => {
        this.tooltipRef.current?.toggle();

        console.log('parent press vẫn chạy');
    };

    render() {
        return (
            <Pressable onPress={this.onPress}>
                <Tooltip
                    ref={this.tooltipRef}
                    trigger="manual"
                    title="Edit"
                    text="Edit this item"
                    value="Active"
                >
                    <EditSVG width={20} color="#2563EB" />
                </Tooltip>
            </Pressable>
        );
    }
}

Table Action Example

import React, { PureComponent } from 'react';
import { View, Text, Pressable, StyleSheet } from 'react-native';
import Tooltip from '@chainplatform/tooltip';
import { setSize } from '@chainplatform/layout';
import EditSVG from './EditSVG';

export default class SkillsItem extends PureComponent {

    tooltipRef = React.createRef();

    onEdit = item => {
        this.tooltipRef.current?.toggle();

        const newItem = {
            id: item?.value || 0,
        };

        console.log(newItem);
    };

    render() {
        const { item, theme } = this.props;

        return (
            <View style={styles.row}>
                <Text style={styles.name}>
                    {item?.label}
                </Text>

                <Pressable onPress={() => this.onEdit(item)}>
                    <Tooltip
                        ref={this.tooltipRef}
                        trigger="manual"
                        title="Thông tin"
                        text="Tooltip được bật từ Pressable cha"
                        value="Active"
                    >
                        <EditSVG
                            width={setSize(20)}
                            color={theme?.colors?.primary}
                        />
                    </Tooltip>
                </Pressable>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    row: {
        minHeight: setSize(40),
        flexDirection: 'row',
        alignItems: 'center',
    },
    name: {
        flex: 1,
        fontSize: setSize(13),
    },
});

Styling Example

<Tooltip
    title="Custom Style"
    text="You can customize tooltip style"
    value="Styled"
    color="#10B981"
    tooltipStyle={{
        backgroundColor: '#020617',
        borderColor: 'rgba(255,255,255,0.12)',
    }}
    arrowStyle={{
        backgroundColor: '#020617',
    }}
    titleStyle={{
        color: '#FFFFFF',
    }}
    textStyle={{
        color: '#CBD5E1',
    }}
    valueStyle={{
        color: '#FACC15',
    }}
>
    <Text>Custom Tooltip</Text>
</Tooltip>

Props

| Prop | Type | Default | Description | | --- | --- | --- | --- | | trigger | 'auto' \| 'hover' \| 'press' \| 'manual' | 'auto' | Tooltip trigger behavior | | placement | 'auto' \| 'top' \| 'bottom' | 'auto' | Tooltip placement | | title | string \| number | '' | Tooltip title | | text | string \| number | '' | Tooltip description | | value | string \| number | '' | Tooltip value text | | color | string | '#3B82F6' | Dot color near title | | content | ReactNode | null | Custom tooltip content | | children | ReactNode | required | Tooltip trigger element | | tooltipWidth | number | setSize(220) | Tooltip width | | offset | number | setSize(8) | Space between trigger and tooltip | | screenPadding | number | setSize(8) | Minimum distance from screen edge | | hoverSafeArea | number | setSize(10) | Safe hover area on web | | style | object \| array | null | Wrapper style | | tooltipStyle | object \| array | null | Tooltip container style | | arrowStyle | object \| array | null | Tooltip arrow style | | overlayStyle | object \| array | null | Modal overlay style | | titleStyle | object \| array | null | Title text style | | textStyle | object \| array | null | Description text style | | valueStyle | object \| array | null | Value text style |


Default Props

Tooltip.defaultProps = {
    trigger: 'auto',
    placement: 'auto',
    title: '',
    text: '',
    value: '',
    color: '#3B82F6',
    content: null,
    style: null,
    tooltipStyle: null,
    arrowStyle: null,
    overlayStyle: null,
    titleStyle: null,
    textStyle: null,
    valueStyle: null,
    offset: setSize(8),
    tooltipWidth: setSize(220),
    screenPadding: setSize(8),
    hoverSafeArea: setSize(10),
};

Platform Behavior

Web

  • Default trigger is hover.
  • Tooltip opens on onMouseEnter.
  • Tooltip closes when mouse leaves the target and tooltip safe area.
  • Tooltip uses Modal.
  • Overlay uses pointerEvents="none" so buttons underneath can still be clicked.
  • Position is calculated with measureInWindow.

iOS / Android

  • Default trigger is press.
  • Tooltip opens on press.
  • Tooltip closes when pressing outside.
  • Tooltip uses Modal transparent.
  • Position is calculated with measureInWindow.

Why Modal?

Tooltip is rendered with Modal to avoid being clipped by parent containers.

This helps when the tooltip is inside:

  • Small table cells
  • ScrollView
  • FlatList rows
  • Cards
  • Containers with limited width or height
  • Containers with overflow: hidden

Notes

Parent Pressable

If the tooltip is inside a parent Pressable, use:

trigger="manual"

Then control it from the parent:

tooltipRef.current?.toggle();

This keeps the parent Pressable working normally.


Web Click Behavior

On web, the tooltip overlay uses:

pointerEvents="none"

This prevents the tooltip modal overlay from blocking clicks on buttons underneath.


Hover Close Behavior

On web, tooltip close is handled by a global mousemove listener.

The tooltip stays open while the mouse is inside:

  • The trigger area
  • The tooltip area
  • The configured hoverSafeArea

Package Structure

@chainplatform/tooltip
├── src
│   ├── Tooltip.js
│   └── index.js
├── package.json
├── README.md
└── LICENSE

index.js

import Tooltip from './Tooltip';

export {
    Tooltip,
};

export default Tooltip;

🪪 License

MIT © 2026 Chain Platform


💖 Support & Donate

If you find this package helpful, consider supporting the development:

| Currency | Address | |----------------|----------| | MB Bank | MB Bank | alt text | Bitcoin (BTC) | 17grbSNSEcEybS1nHh4TGYVodBwT16cWtc | alt text | Ethereum (ETH) | 0xa2fd119a619908d53928e5848b49bf1cc15689d4 | alt text | Tron (TRX) | TYL8p2PLCLDfq3CgGBp58WdUvvg9zsJ8pd | alt text | DOGE (DOGE) | DDfKN2ys4frNaUkvPKcAdfL6SiVss5Bm19 | | USDT (SOLANA) | cPUZsb7T9tMfiZFqXbWbRvrUktxgZQXQ2Ni1HiVXgFm |

Your contribution helps maintain open-source development under the Chain Platform ecosystem 🚀