{"id":29822051,"url":"https://github.com/moxystudio/react-split-text","last_synced_at":"2025-07-29T00:14:53.344Z","repository":{"id":43953237,"uuid":"257936499","full_name":"moxystudio/react-split-text","owner":"moxystudio","description":"A react component that wraps each word of a sentence into a \u003cspan\u003e element.","archived":false,"fork":false,"pushed_at":"2023-01-06T04:02:06.000Z","size":2724,"stargazers_count":7,"open_issues_count":10,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-24T08:18:12.214Z","etag":null,"topics":["base","react"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/moxystudio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-22T15:07:39.000Z","updated_at":"2025-03-19T18:27:00.000Z","dependencies_parsed_at":"2023-02-05T06:46:27.652Z","dependency_job_id":null,"html_url":"https://github.com/moxystudio/react-split-text","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":"moxystudio/react-lib-template","purl":"pkg:github/moxystudio/react-split-text","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxystudio%2Freact-split-text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxystudio%2Freact-split-text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxystudio%2Freact-split-text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxystudio%2Freact-split-text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moxystudio","download_url":"https://codeload.github.com/moxystudio/react-split-text/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxystudio%2Freact-split-text/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267178835,"owners_count":24048224,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["base","react"],"created_at":"2025-07-29T00:14:48.192Z","updated_at":"2025-07-29T00:14:53.335Z","avatar_url":"https://github.com/moxystudio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-split-text\n\n[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][build-status-image]][build-status-url] [![Coverage Status][codecov-image]][codecov-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url]\n\n[npm-url]:https://npmjs.org/package/@moxy/react-split-text\n[downloads-image]:https://img.shields.io/npm/dm/@moxy/react-split-text.svg\n[npm-image]:https://img.shields.io/npm/v/@moxy/react-split-text.svg\n[build-status-url]:https://github.com/moxystudio/react-split-text/actions\n[build-status-image]:https://img.shields.io/github/workflow/status/moxystudio/react-split-text/Node%20CI/master\n[codecov-url]:https://codecov.io/gh/moxystudio/react-split-text\n[codecov-image]:https://img.shields.io/codecov/c/github/moxystudio/react-split-text/master.svg\n[david-dm-url]:https://david-dm.org/moxystudio/react-split-text\n[david-dm-image]:https://img.shields.io/david/moxystudio/react-split-text.svg\n[david-dm-dev-url]:https://david-dm.org/moxystudio/react-split-text?type=dev\n[david-dm-dev-image]:https://img.shields.io/david/dev/moxystudio/react-split-text.svg\n\nA react component that wraps each word of a sentence into a `\u003cspan\u003e` element.\n\n## Installation\n\n```sh\n$ npm install @moxy/react-split-text\n```\n\nThis library is written in modern JavaScript and is published in both CommonJS and ES module transpiled variants. If you target older browsers please make sure to transpile accordingly.\n\n## Motivation\n\nSometimes there's a need to split a sentence into multiple elements, either to individually animate or simply style them. The `SplitText` component receives a string and splits it (with a [separator](#separator) of your choice) into multiple `\u003cspan\u003e`s.\n\n## Usage\n\n```js\nimport React from 'react';\nimport SplitText from '@moxy/react-split-text';\n\nconst MyPage = (props) =\u003e (\n    \u003cdiv className=\"container\"\u003e\n        \u003cSplitText className=\"word\"\u003eLorem ipsum dolor sit amet.\u003c/SplitText\u003e\n    \u003c/div\u003e\n);\n\nexport default MyPage;\n```\n\nImport the stylesheet in the project's entry JavaScript file:\n\n```js\nimport '@moxy/react-split-text/dist/index.css';\n```\n\n## API\n\nBesides the following supported props by the `SplitText` component, additional props are spread to each child.\n\n#### children\n\nType: `string` | Required: `true`\n\nText to be split and rendered inside the component.\n\n#### className\n\nType: `string` | Required: `false`\n\nA className to apply to each child.\n\n#### separator\n\nType: `string` | Required: `false` | Default: `non-breaking space`\n\nThe pattern describing where each split should occur, just like the one from [String.prototype.split()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split).\n\n## Tests\n\n```sh\n$ npm test\n$ npm test -- --watch # during development\n```\n\n## Demo\n\nA demo [Next.js](https://nextjs.org/) project is available in the [`/demo`](./demo) folder so you can try out this component.\n\nFirst, build the `react-split-text` project with:\n\n```sh\n$ npm run build\n```\n\nTo run the demo, do the following inside the demo's folder:\n\n```sh\n$ npm i\n$ npm run dev\n```\n\n*Note: Everytime a change is made to the package a rebuild is required to reflect those changes on the demo.*\n\n## FAQ\n\n### I can't override the component's CSS, what's happening?\n\nThere is an ongoing [next.js issue](https://github.com/zeit/next.js/issues/10148) about the loading order of modules and global CSS in development mode. This has been fixed in [v9.3.6-canary.0](https://github.com/zeit/next.js/releases/tag/v9.3.6-canary.0), so you can either update `next.js` to a version higher than `v9.3.5`, or simply increase the CSS specificity when overriding component's classes, as we did in the [`demo`](./demo/pages/index.module.css), e.g. having the page or section CSS wrap the component's one.\n\n## License\n\nReleased under the [MIT License](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoxystudio%2Freact-split-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoxystudio%2Freact-split-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoxystudio%2Freact-split-text/lists"}