React component which ellipsis text
npm install react-ellipsis-text
React text ellipsify component
``bash`
npm install --save react-ellipsis-text
#### Props
`javascript`
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.
`javascript
"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 (
React.render(
// It will be
//
See example
`bash
npm install
npm run start:example
`Tests
`bash
npm run test:local
``