{"id":17242596,"url":"https://github.com/robinweser/react-create-keyframe","last_synced_at":"2026-01-26T09:35:02.908Z","repository":{"id":244545791,"uuid":"815230627","full_name":"robinweser/react-create-keyframe","owner":"robinweser","description":"Helper to create and render keyframes on-demand in React","archived":false,"fork":false,"pushed_at":"2024-06-16T16:56:55.000Z","size":64,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T12:51:05.013Z","etag":null,"topics":["css","keyframes","react","react-component"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robinweser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"robinweser"}},"created_at":"2024-06-14T16:30:12.000Z","updated_at":"2024-06-18T16:25:23.000Z","dependencies_parsed_at":"2024-06-15T14:47:39.659Z","dependency_job_id":"abe38e6e-8f19-4ac4-a438-ee40d0a1956e","html_url":"https://github.com/robinweser/react-create-keyframe","commit_stats":null,"previous_names":["robinweser/react-create-keyframe"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/robinweser/react-create-keyframe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinweser%2Freact-create-keyframe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinweser%2Freact-create-keyframe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinweser%2Freact-create-keyframe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinweser%2Freact-create-keyframe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robinweser","download_url":"https://codeload.github.com/robinweser/react-create-keyframe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinweser%2Freact-create-keyframe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28772914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T08:38:24.014Z","status":"ssl_error","status_checked_at":"2026-01-26T08:38:22.080Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["css","keyframes","react","react-component"],"created_at":"2024-10-15T06:13:36.987Z","updated_at":"2026-01-26T09:35:02.879Z","avatar_url":"https://github.com/robinweser.png","language":"TypeScript","funding_links":["https://github.com/sponsors/robinweser"],"categories":[],"sub_categories":[],"readme":"# react-create-keyframe\n\nA simple helper to create and render keyframes on on-demand.\u003cbr /\u003e\nIt (optionally) utilises React's new [style hoisting feature](https://react.dev/reference/react-dom/components/style#rendering-an-inline-css-stylesheet) when available.\n\n\u003e **Note**: Style hoisting requires a canary version of React. Install via `react@canary`.\n\n\u003cimg alt=\"npm version\" src=\"https://badge.fury.io/js/react-create-keyframe.svg\"\u003e \u003cimg alt=\"npm downloads\" src=\"https://img.shields.io/npm/dm/react-create-keyframe.svg\"\u003e \u003ca href=\"https://bundlephobia.com/result?p=react-create-keyframe@latest\"\u003e\u003cimg alt=\"Bundlephobia\" src=\"https://img.shields.io/bundlephobia/minzip/react-create-keyframe.svg\"\u003e\u003c/a\u003e\n\n## Installation\n\n```sh\n# npm\nnpm i --save react-create-keyframe\n# yarn\nyarn add react-create-keyframe\n# pnpm\npnpm add react-create-keyframe\n```\n\n## The Gist\n\n```tsx\nimport * as React from 'react'\nimport { createKeyframe } from 'react-create-keyframe'\n\nconst [animationName, node] = createKeyframe({\n  from: {\n    backgroundColor: 'red',\n  },\n  to: {\n    backgroundColor: 'blue',\n    transform: 'rotate(360deg)',\n  },\n})\n\nfunction Component() {\n  return (\n    \u003c\u003e\n      {node}\n      \u003cdiv\n        style={{\n          width: 50,\n          height: 50,\n          backgroundColor: 'red',\n          animationName,\n          animationDuration: '1s',\n          animationIterationCount: 'infinite',\n        }}\n      /\u003e\n    \u003c/\u003e\n  )\n}\n```\n\n## API Reference\n\n### createKeyframe\n\nThe only export of this package.\u003cbr /\u003e\nIt takes a keyframe style object and an optional nonce and returns both the keyframe name as well as a single React `\u003cstyle\u003e` node.\n\nIt converts camel case properties to dash case equivalent, but it does not add units to numbers.\n\n| Parameter |  Type                   |  Description              |\n| --------- | ----------------------- | ------------------------- |\n| keyframe  | [Keyframe](#keyframe)   | A keyframe style object   |\n| nonce     | `string?`               | (_optional_) nonce string |\n\n#### Keyframe\n\n```\nPartial\u003cRecord\u003c'from' | 'to' | `${number}%`, CSSProperties\u003e\u003e\n```\n\n#### Example\n\n```ts\nconst keyframe = {\n  // equivalent to 0%\n  from: {\n    color: 'red',\n  },\n  '50%': {\n    color: 'green',\n  },\n  // equivalent to 100%\n  to: {\n    color: 'blue',\n  },\n}\n\nconst [animationName, node] = createKeyframe(keyframe)\n```\n\n## Recipes\n\n### Adding Units\n\nIf you want units to be added to your properties automatically, you can create your own helper or utilise existing packages such as [fela-plugin-unit](https://github.com/robinweser/fela/tree/master/packages/fela-plugin-unit#fela-plugin-unit).\n\n\u003e **Note**: Most fela plugins are isolated and do not require fela to be installed or used.\n\n```ts\nimport { createKeyframe, Keyframe } from 'react-create-keyframe'\nimport unit from 'fela-plugin-unit'\n\n// further customise by passing a config object to the plugin\nconst addUnits = unit()\n\nconst keyframe = {\n  from: {\n    fontSize: 16,\n  },\n  to: {\n    fontSize: 20,\n  },\n}\n\ncreateKeyframe(addUnits(keyframe))\n```\n\n## License\n\nreact-create-keyframe is licensed under the [MIT License](http://opensource.org/licenses/MIT).\u003cbr\u003e\nDocumentation is licensed under [Creative Common License](http://creativecommons.org/licenses/by/4.0/).\u003cbr\u003e\nCreated with ♥ by [@robinweser](http://weser.io) and all the great contributors.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobinweser%2Freact-create-keyframe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobinweser%2Freact-create-keyframe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobinweser%2Freact-create-keyframe/lists"}