New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-ellipsis-text

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-ellipsis-text

React component which ellipsis text

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

react-ellipsis-text Build Status npm version codebeat badge

NPM React text ellipsify component

Demo

View Demo

Installation

npm install --save react-ellipsis-text

API

EllipsisText

Props
EllipsisText.propTypes = {
  text: PropTypes.string.isRequired,
  length: PropTypes.number.isRequired,
  tail: PropTypes.string,
  tailClassName: PropTypes.string,
  tooltip: PropTypes.shape({
    copyOnClick: PropTypes.bool,
    onAppear: PropTypes.func,
    onDisapepear: PropTypes.func
  })
};
  • text: Text to display

  • length: Max length of text

  • tail: Trailing string (Default '...')

  • tailClassName: Trailing string element's class name

  • tooltip: Tooltip will be display when supplied

  • tooltip.clipboard: Original text will be copied into clipboard when tooltip is clicked.

  • tooltip.onAppear: Called when tooltip is shown.

  • tooltip.onDisapepear: Called when tooltip is hidden.

Usage example

"use strict";

import React from "react";
import EllipsisText from "react-ellipsis-text";

//allow react dev tools work
window.React = React;

class App extends React.Component {
  constructor(props) {
    super(props);
  }

  render() {
    return (
      <div>
        <EllipsisText text={"1234567890"} length={"5"} />
      </div>
    );
  }
}

React.render(<App />, document.getElementById("out"));

// It will be
// <div>
//   <span><span>12</sapn><span class='more'>...</span></span>
//  </div>
//

See example

npm install
npm run start:example

Tests

npm run test:local

Keywords

FAQs

Package last updated on 16 Jul 2019

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc