1.0.3 • Published 4 years ago

react-text-trim v1.0.3

Weekly downloads
29
License
-
Repository
github
Last release
4 years ago

react-text-trim

Customizable text trimmer

NPM JavaScript Style Guide

Live Demo here

trimmer

Install

npm install --save react-text-trim

Usage

<TextTrim 
    refId="TextTrim"
    text="Lorem ipsum dolor sit amet, consecter adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
    minLines={2}
    maxLines={5}
    showMoreLabel="Show More"
    showLessLabel="Show Less"
    delimiter="..."
    fontSize={14}
    lineHeight={16}
    containerStyle={{}}
    textWrapperStyle={{}}
    buttonStyle={{}}
/>

Props

nametypedescriptiondefault value
refId*stringunique id for the component---
textstringthe text to trim---
minLinesnumberthe number of lines to show when trimmed3
maxLinesnumberthe number of lines to display when text is not trimmed, if the text is longer it will be scrollable, to disable this prop and display the all text just pass 00
showMoreLabelstringthe label for the toggle element when text is trimmed"Show More"
showLessLabelstringthe label for the toggle element when text is not trimmed"Show Less"
delimiterstringthe suffix for the text"..."
fontSizenumberthe font size of text (in pixels)13
lineHeightnumberthe height of each line (in pixels)16
containerStyleobjectstyles for the container element---
textWrapperStyleobjectstyles for the text wrapping container element---
buttonStyleobjectstyles for the toggle element---

License

© NadavShaar

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.1

7 years ago