Socket
Book a DemoInstallSign in
Socket

react-text-ellipsis-component

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-text-ellipsis-component

React component for ellipsis one-line text

0.0.3
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

React Text Ellipsis Component

Check

React component for ellipsis one-line text with tooltip. Ready for work as a text component for large tables and adapted for convenient work with text and browser search friendly.

Live

Story book

Feel free to check documentation and playground - storybook.

Test CRA app

Feel free to check test create react app application - website, repository.

Description

The component is zero dependency and made with React 18 as peer-dependency, typescript, postcss, rollup, babel, storybook, jest, eslint, stylelint as dev-dependencies. It uses Github CI for CI and Netlify for Storybook deployment.

The component is made by display: flex; because display: inline-block; breaks the primary goal of the component: to have an ellipsis in the middle of the text. It doesn't use JavaScript for the main logic so it operates very fast. Browser search logic works from scatch, copying (including cross columns) made by custom JavaScript but it doesn't affect rendering.

The tooltip is pretty simple and could be easily updated to full-featured if necessary.

Installation

The component available via npm.

npm i react-text-ellipsis-component

Props

NameTypeOptionalDescription
childrenstringText
tailLengthnumberLength of the tail that will be persistent in a case of ellipsis
titlestringTooltip text
classNamestringCustom class for main component container

TODO

  • Tooltip logic for touch-devices
  • Tests for non-trivial cases: ellipsis, text copying, text searching
  • Minor issue with required children description in Storybook
  • React 18 Storybook issue (warnings during dependencies installation)

FAQs

Package last updated on 01 Oct 2022

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.