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

react-text-loop

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-text-loop

Create an animated loop of a list of text for your headings

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
decreased by-61.04%
Maintainers
1
Weekly downloads
 
Created
Source

react-text-loop

text-loop2

An animated loop of text nodes for your headings. Uses react-motion for the transition so it handles super fast animations and spring params.


Installation

npm install react-text-loop || yarn add react-text-loop

How to use

Code

import TextLoop from 'react-text-loop';

class App extends Component {
    render() {
        return (
            <h2>
                <TextLoop>
                    <span>First item</span>
                    <Link to="/">Second item</Link>
                    <BodyText>Third item</BodyText>
                </TextLoop> and something else.
            </h2>
        );
    };
}

Props

PropTypeDefaultDefinition
speednumber3000The speed that the words change (in ms). Set to 0 to stop animation.
adjustingSpeednumber150The speed that the container around each word adjusts to the next one (in ms)
fadebooleantrueEnable or disable the fade animation on enter and leave
maskbooleanfalseMask the animation around the bounding box of the animated content
springConfigobject{ stiffness: 340, damping: 30 }Configuration for react-motion spring
styleobject or arrayAny additional styles you might want to send to the wrapper. Uses glamor to process it so you can send either objects or arrays.
childrennodeThe words you want to loop (required)

Caveats

Because <TextLoop> loops through its children nodes, only root-level nodes will be considered so doing something like:

<TextLoop>
    <div>
        <span>First item</span>
        <span>Second item</span>
    </div>
    <div>Third item</div>
</TextLoop>

will make first and second item to be treated as one and animate together.

You can also just send a normal array as children prop if you don't need any individual styling for each node.

<TextLoop
    children={[
        "Trade faster",
        "Increase sales",
        "Stock winners",
        "Price perfectly"
    ]}
/>

Examples

Fast transition

text-loop-fast-small

<TextLoop speed={100}>
    ...
</TextLoop>

Wobbly animation

text-loop-bouncy

<TextLoop springConfig={{ stiffness: 180, damping: 8 }}>
    ...
</TextLoop>

Contributing

Please follow our contributing guidelines.

License

MIT

Keywords

FAQs

Package last updated on 01 Jun 2017

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