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

rc-tc-ifn

v3.0.0

Published

React component that truncates text with ellipsis and shows tooltip only when content overflows.

Readme

💬 rc-tc-ifn

NPM Downloads

LIVE EXAMPLE


Smart truncate + tooltip component for React 18+.
Built on top of react-tooltip-z.

Automatically truncates text with ellipsis only when needed and shows tooltip when content overflows.


Why rc-tc-ifn?

  • ✂️ Auto truncate with text-overflow: ellipsis
  • 🧠 Tooltip shows only if content overflows
  • 🎯 Zero manual overflow checking
  • 📦 Lightweight wrapper
  • 🪟 Portal-based tooltip (via react-tooltip-z)
  • 🎨 Fully customizable tooltip props
  • ⚡ React 18+ ready

Perfect for:

  • Table cells
  • Dropdown lists
  • Select menus
  • Data grids
  • Compact UI layouts

Installation

npm install rc-tc-ifn

Basic Usage

import TooltipIfn from "rc-tc-ifn";

export function Example() {
  return (
    <TooltipIfn width={120} placement="right">
      Very long content here that might overflow
    </TooltipIfn>
  );
}

If the content exceeds 120px → it will truncate and show tooltip.
If not → it renders normally (no tooltip).


Custom Content

<TooltipIfn
  width="150px"
  content="Custom tooltip content"
  placement="top"
>
  Long text here...
</TooltipIfn>

Props

All tooltip-related props are inherited from react-tooltip-z
(except trigger and open, which are internally controlled).

| Prop | Type | Default | Description | |---------------------|--------------------------|-----------|-------------------------------------------| | children | ReactNode | — | Target element | | content | string \| ReactNode | children| Tooltip content | | width | string \| number | — | Width applied to truncated child | | wrapperWidth | string \| number | — | Width applied to wrapper | | tagName | string | "span" | Wrapper tag | | truncateClassName | string | — | Custom class for truncated element | | ...rest | any | — | Forwarded to react-tooltip-z props |


Behavior Notes

  • Tooltip only appears when content overflows.
  • No CSS import required (CSS injected via JS).
  • trigger and open props are disabled (hover-only behavior).
  • Child element must accept ref (DOM or forwardRef component).

Comparison

| Criteria | rc-tc-ifn | Manual Implementation | | ---------------------- | :-------: | :--------------------: | | Smart overflow check | ✅ | ❌ | | Tooltip only if needed | ✅ | ❌ | | Portal support | ✅ | ⚠️ | | API simplicity | ✅ | ❌ | | Setup time | ✅ | ❌ |

Notes

  • ✅ Built-in overflow detection — no extra logic required
  • ✅ Tooltip renders only when necessary — avoids unnecessary DOM updates
  • ✅ Portal support included — better layering & positioning
  • ⚠️ Manual approach may support portal, but requires custom setup
  • ❌ Manual implementation requires repetitive boilerplate and edge-case handling

License

MIT