1.1.7 • Published 1 year ago

reactletteroverflow v1.1.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

ReactLetterOverflow

This lib is intended for people who need text to be delimited based on the size of the parent container whose size is not necessarily passed in pixels but in any type of measurement

Installation

   yarn add reactletteroverflow

or

   npm install reactletteroverflow

Getting start

basic example of use

import { ReactLetterOverflow } from "reactletteroverflow";

<ReactLetterOverflow>
   {(props) => (
      <p ref={props}>
         Hello word
      </p>
   )}
</ReactLetterOverflow>

Complete example

a complete example of how to use it to get the lib to work completely

NOTE: It's worth remembering that for now the lib will limit content in just one line

import { ReactLetterOverflow } from "reactletteroverflow";

funtion App () {

   return (
      <div style={{
         width: '50%', //here it can be any value
      }}>
         <ReactLetterOverflow>
            {(props) => (
               <p ref={props}>
                  Hello word
               </p>
            )}
         </ReactLetterOverflow>
      </div>
   );
}

export default App;

Use with state

If your content is in a state, follow the step below

import { useState } from "react";
import { ReactLetterOverflow } from "reactletteroverflow";

funtion App () {

   const [content, set_content] = useState('');

   return (
      <div style={{
         width: '50%', //here it can be any value
      }}>
         <ReactLetterOverflow
            content={content}
         >
            {(props) => (
               <p ref={props}>
                  {content}
               </p>
            )}
         </ReactLetterOverflow>
      </div>
   );
}

export default App;

API

PropertyDefault valueTypeDefinition
enable_title?trueBooleanspecifies whether, when the content is delimited, whether the entire content should be in the title property
delimiter?...StringWith this prop you can modify the delimiter that goes at the end of the content, e.g: '...', '...se more'
content?undefinedStringProperty used when your content is in a state

Future intentions

That it is possible to specify how many lines the content will be delimited in and that the delimiter property can have click events that when triggered make it possible to release all the content for viewing

License

MIT

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago