New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

rc-tc-ifn

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-tc-ifn

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

latest
Source
npmnpm
Version
3.0.0
Version published
Weekly downloads
26
-53.57%
Maintainers
1
Weekly downloads
 
Created
Source

💬 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).

PropTypeDefaultDescription
childrenReactNodeTarget element
contentstring | ReactNodechildrenTooltip content
widthstring | numberWidth applied to truncated child
wrapperWidthstring | numberWidth applied to wrapper
tagNamestring"span"Wrapper tag
truncateClassNamestringCustom class for truncated element
...restanyForwarded 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

Criteriarc-tc-ifnManual 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

Keywords

react

FAQs

Package last updated on 20 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts