react-truncate-inside
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

React Truncate Inside

React component for adding an ellipsis to the middle of a line of text.

Inspired by pablosichert / react-truncate

CPT2308101505-376x87

Online Demo


Install

npm install react-truncate-inside

Usage

import React from 'react';
import Truncate from 'react-truncate-inside';

export default function Demo() {
    return <Truncate text="An-Extremely-Long-Filename.pdf" width="100" />
}

Props

Name Type Desc Default
text string
width number Width of the element parentNode.width
offset number Position(from the end) of the ellipsis that shows in text 8
ellipsis string Ellipsis that is added into the text in case it is truncated '...'

License

MIT License

Dependencies (0)

    Dev Dependencies (26)

    Package Sidebar

    Install

    npm i react-truncate-inside

    Weekly Downloads

    318

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    18.1 kB

    Total Files

    15

    Last publish

    Collaborators

    • zhiyuc123