{"id":13469711,"url":"https://github.com/braposo/react-text-loop","last_synced_at":"2025-05-15T13:08:00.068Z","repository":{"id":37692633,"uuid":"85611345","full_name":"braposo/react-text-loop","owner":"braposo","description":"Animate words in your headings","archived":false,"fork":false,"pushed_at":"2023-01-07T05:13:52.000Z","size":1331,"stargazers_count":884,"open_issues_count":34,"forks_count":65,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-05-07T20:38:51.985Z","etag":null,"topics":["animation","cycle","loop","react","react-component","text"],"latest_commit_sha":null,"homepage":"https://codesandbox.io/s/react-text-loop-playground-br4q1","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/braposo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-20T18:22:24.000Z","updated_at":"2025-03-12T16:03:28.000Z","dependencies_parsed_at":"2023-02-06T12:45:52.957Z","dependency_job_id":null,"html_url":"https://github.com/braposo/react-text-loop","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/braposo%2Freact-text-loop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/braposo%2Freact-text-loop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/braposo%2Freact-text-loop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/braposo%2Freact-text-loop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/braposo","download_url":"https://codeload.github.com/braposo/react-text-loop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253666073,"owners_count":21944621,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","cycle","loop","react","react-component","text"],"created_at":"2024-07-31T15:01:52.078Z","updated_at":"2025-05-15T13:07:55.803Z","avatar_url":"https://github.com/braposo.png","language":"TypeScript","readme":"## react-text-loop\n\n![text-loop2](https://cloud.githubusercontent.com/assets/38172/24254063/d5e9c38c-0fd9-11e7-9b75-46dc00421cd7.gif)\n\nAn animated loop of text nodes for your headings. Uses\n[react-motion](https://github.com/chenglou/react-motion) for the transition so it handles super fast\nanimations and spring params.\n\n[![npm version][version-badge]][npm]\n[![npm downloads][downloads-badge]][npm]\n[![gzip size][size-badge]][size]\n[![MIT License][license-badge]][license]\n[![PRs Welcome][prs-badge]][prs]\n\n---\n\n## Installation\n\n`npm install react-text-loop` or `yarn add react-text-loop`\n\n## How to use\n\n[![Edit react-text-loop][codesandbox-badge]][codesandbox]\n\nYou can also run the examples by cloning the repo and running `yarn start`.\n\n### Usage\n\n```jsx\nimport TextLoop from \"react-text-loop\";\nimport Link from \"react-router\";\nimport { BodyText } from \"./ui\";\n\nclass App extends Component {\n    render() {\n        return (\n            \u003ch2\u003e\n                \u003cTextLoop\u003e\n                    \u003cspan\u003eFirst item\u003c/span\u003e\n                    \u003cLink to=\"/\"\u003eSecond item\u003c/Link\u003e\n                    \u003cBodyText\u003eThird item\u003c/BodyText\u003e\n                \u003c/TextLoop\u003e{\" \"}\n                and something else.\n            \u003c/h2\u003e\n        );\n    }\n}\n```\n\n### Props\n\n| Prop           | Type            | Default                           | Definition                                                                                                                                    |\n| -------------- | --------------- | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |\n| interval       | number \\| array | `3000`                            | The frequency (in ms) that the words change. Can also pass an array if you want a different interval per children |\n| delay       | number | `0`                            | A delay (in ms) for the animation to start. This allows to use multiple instances to create a staggered animation effect for example. |\n| adjustingSpeed | number          | `150`                             | The speed that the container around each word adjusts to the next one (in ms). Usually you don't need to change this.                                                                 |\n| fade           | boolean         | `true`                            | Enable or disable the fade animation on enter and leave                                                                                       |\n| mask           | boolean         | `false`                           | Mask the animation around the bounding box of the animated content                                                                            |\n| noWrap           | boolean         | `true`                           | Disable `whitepace: nowrap` style for each element. This is used by default so we can always get the right width of the element but can have issues sometimes. |\n| springConfig   | object          | `{ stiffness: 340, damping: 30 }` | Configuration for [react-motion spring](https://github.com/chenglou/react-motion#--spring-val-number-config-springhelperconfig--opaqueconfig) |\n| className | string | | Any additional CSS classes you might want to use to style the image |\n| children       | node            |                                   | The words you want to loop (required)                                                                                                         |\n\n### Caveats\n\nBecause `\u003cTextLoop\u003e` loops through its children nodes, only root-level nodes will be considered so\ndoing something like:\n\n```jsx\n\u003cTextLoop\u003e\n    \u003cdiv\u003e\n        \u003cspan\u003eFirst item\u003c/span\u003e\n        \u003cspan\u003eSecond item\u003c/span\u003e\n    \u003c/div\u003e\n    \u003cdiv\u003eThird item\u003c/div\u003e\n\u003c/TextLoop\u003e;\n```\n\nwill make first and second item to be treated as one and animate together.\n\nYou can also just send a normal array as children prop if you don't need any individual styling for\neach node.\n\n```jsx\n\u003cTextLoop children={[\"Trade faster\", \"Increase sales\", \"Stock winners\", \"Price perfectly\"]} /\u003e;\n```\n\n## Examples\n\n### Fast transition\n\n![text-loop-fast-small](https://cloud.githubusercontent.com/assets/38172/24275301/5d48c6e2-1026-11e7-85b8-e7cfe07f4714.gif)\n\n```jsx\n\u003cTextLoop interval={100}\u003e...\u003c/TextLoop\u003e;\n```\n\n### Wobbly animation\n\n![text-loop-bouncy](https://cloud.githubusercontent.com/assets/38172/24275347/b0e45b2c-1026-11e7-8e04-04bdafdef249.gif)\n\n```jsx\n\u003cTextLoop springConfig={{ stiffness: 180, damping: 8 }}\u003e...\u003c/TextLoop\u003e;\n```\n\nFor many other examples, please have a look at the [CodeSandbox playground][codesandbox].\n\n## Contributing\n\nPlease follow our\n[contributing guidelines](https://github.com/braposo/react-text-loop/blob/master/CONTRIBUTING.md).\n\n## License\n\n[MIT](https://github.com/braposo/react-text-loop/blob/master/LICENSE)\n\n[npm]: https://www.npmjs.com/package/react-text-loop\n[license]: https://github.com/braposo/react-text-loop/blob/master/LICENSE\n[prs]: http://makeapullrequest.com\n[size]: https://unpkg.com/react-text-loop/dist/react-text-loop.min.js\n[version-badge]: https://img.shields.io/npm/v/react-text-loop.svg?style=flat-square\n[downloads-badge]: https://img.shields.io/npm/dm/react-text-loop.svg?style=flat-square\n[license-badge]: https://img.shields.io/npm/l/react-text-loop.svg?style=flat-square\n[size-badge]: http://img.badgesize.io/https://unpkg.com/react-text-loop/dist/react-text-loop.min.js?compression=gzip\u0026style=flat-square\n[modules-badge]: https://img.shields.io/badge/module%20formats-umd%2C%20cjs%2C%20esm-green.svg?style=flat-square\n[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square\n[codesandbox-badge]: https://codesandbox.io/static/img/play-codesandbox.svg\n[codesandbox]: https://codesandbox.io/s/react-text-loop-playground-br4q1\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbraposo%2Freact-text-loop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbraposo%2Freact-text-loop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbraposo%2Freact-text-loop/lists"}