{"id":14990291,"url":"https://github.com/lottiefiles/lottie-player","last_synced_at":"2025-05-14T10:09:39.444Z","repository":{"id":37732940,"uuid":"185189101","full_name":"LottieFiles/lottie-player","owner":"LottieFiles","description":"Lottie viewer/player as an easy to use web component! https://lottiefiles.com/web-player","archived":false,"fork":false,"pushed_at":"2024-03-04T15:08:52.000Z","size":3467,"stargazers_count":1554,"open_issues_count":73,"forks_count":174,"subscribers_count":33,"default_branch":"master","last_synced_at":"2024-10-29T15:23:14.813Z","etag":null,"topics":["bodymovin","lit-element","lottie","lottie-web","web-component"],"latest_commit_sha":null,"homepage":"","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/LottieFiles.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-05-06T12:07:29.000Z","updated_at":"2024-10-29T03:11:14.000Z","dependencies_parsed_at":"2024-03-04T16:43:41.402Z","dependency_job_id":"4548ddb1-e6fc-46a3-baa3-4973d6713f8f","html_url":"https://github.com/LottieFiles/lottie-player","commit_stats":{"total_commits":164,"total_committers":10,"mean_commits":16.4,"dds":0.6585365853658536,"last_synced_commit":"56e1f4fda90e01148654313dc15894987b2776a9"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LottieFiles%2Flottie-player","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LottieFiles%2Flottie-player/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LottieFiles%2Flottie-player/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LottieFiles%2Flottie-player/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LottieFiles","download_url":"https://codeload.github.com/LottieFiles/lottie-player/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248338026,"owners_count":21087150,"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":["bodymovin","lit-element","lottie","lottie-web","web-component"],"created_at":"2024-09-24T14:19:50.208Z","updated_at":"2025-04-11T03:36:41.241Z","avatar_url":"https://github.com/LottieFiles.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## lottie-player Web Component\n\nThis is a Web Component for easily embedding and playing Lottie animations and the Lottie-based Telegram Sticker (tgs) animations in websites.\n\n[![npm](https://img.shields.io/npm/v/@lottiefiles/lottie-player.svg)](https://www.npmjs.com/package/@lottiefiles/lottie-player)\n[![webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/@lottiefiles/lottie-player)\n\n## Demo\n\n![screencast](https://i.imgur.com/miLzIkJ.gif)\n\n[Basic usage examples](https://codesandbox.io/s/y2nxyvomyj)\n\n## Documentation\n\nFor full documentation, visit [docs.lottiefiles.com/lottie-player](https://docs.lottiefiles.com/lottie-player/)\n\n## Installation\n\n#### In HTML, import from CDN or from the local Installation:\n\n##### Lottie Player:\n\n- Import from CDN.\n\n```html\n\u003cscript src=\"https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js\"\u003e\u003c/script\u003e\n```\n\n- Import from local node_modules directory.\n\n```html\n\u003cscript src=\"/node_modules/@lottiefiles/lottie-player/dist/lottie-player.js\"\u003e\u003c/script\u003e\n```\n\n##### Telegram Sticker (TGS) Player:\n\n- Import from CDN.\n\n```html\n\u003cscript src=\"https://unpkg.com/@lottiefiles/lottie-player@latest/dist/tgs-player.js\"\u003e\u003c/script\u003e\n```\n\n- Import from local node_modules directory.\n\n```html\n\u003cscript src=\"/node_modules/@lottiefiles/lottie-player/dist/tgs-player.js\"\u003e\u003c/script\u003e\n```\n\n#### In Javascript or TypeScript:\n\n1. Install package using npm or yarn.\n\n```shell\nnpm install --save @lottiefiles/lottie-player\n```\n\n2. Import package in your code.\n\n```javascript\nimport \"@lottiefiles/lottie-player\";\n```\n\n## Usage\n\n### Lottie-Player\n\nAdd the element `lottie-player` and set the `src` property to a URL pointing to a valid Bodymovin JSON.\n\n```html\n\u003clottie-player\n  autoplay\n  controls\n  loop\n  mode=\"normal\"\n  src=\"https://assets3.lottiefiles.com/packages/lf20_UJNc2t.json\"\n  style=\"width: 320px\"\n\u003e\n\u003c/lottie-player\u003e\n```\n\nYou may set and load animations programatically as well.\n\n```html\n\u003clottie-player autoplay controls loop mode=\"normal\" style=\"width: 320px\"\u003e\n\u003c/lottie-player\u003e\n```\n\n```js\nconst player = document.querySelector(\"lottie-player\");\nplayer.addEventListener(\"rendered\", (e) =\u003e {\n  //Load via URL\n  player.load(\"https://assets3.lottiefiles.com/packages/lf20_UJNc2t.json\");\n  // or load via a Bodymovin JSON string/object\n  player.load(\n    '{\"v\":\"5.3.4\",\"fr\":30,\"ip\":0,\"op\":38,\"w\":315,\"h\":600,\"nm\":\"new\", ... }'\n  );\n});\n```\n\n### TGS-Player\n\nAdd the element `tgs-player` and set the `src` property to a URL pointing to a valid TGS JSON.\n\n```html\n\u003ctgs-player autoplay loop mode=\"normal\" src=\"https//domain/example.tgs\"\u003e\n\u003c/tgs-player\u003e\n```\n\n### ReactJS \u0026 VueJS\n\nImport the player either as\n\n```js\nimport * as LottiePlayer from \"@lottiefiles/lottie-player\";\n```\n\nor\n\n```js\nrequire(\"@lottiefiles/lottie-player\");\n```\n\nUse as follows\n\n```html\n\u003clottie-player\n  autoplay\n  controls\n  loop\n  mode=\"normal\"\n  src=\"https://assets3.lottiefiles.com/packages/lf20_UJNc2t.json\"\n  style=\"width: 320px\"\n\u003e\u003c/lottie-player\u003e\n```\n\n### Typescript ReactJS\n\nImport the player either as\n\n```js\nimport * as LottiePlayer from \"@lottiefiles/lottie-player\";\n```\n\nor\n\n```js\nrequire(\"@lottiefiles/lottie-player\");\n```\n\nUse as follows\n\n```html\n\u003clottie-player\n  autoplay\n  controls\n  loop\n  mode=\"normal\"\n  src=\"https://assets3.lottiefiles.com/packages/lf20_UJNc2t.json\"\n  style=\"width: 320px\"\n\u003e\u003c/lottie-player\u003e\n```\n\nFor typescript projects an added step is required. The component must be declared as a JSX intrinsic element. Create a file 'declarations.d.ts' in the root of your project and add the code below to the file.\n\n```js\ndeclare namespace JSX {\n  interface IntrinsicElements {\n    \"lottie-player\": any;\n  }\n}\n```\n\n### Nuxt 2\n\nCreate a `lottie-player.js` file inside the `/plugins` folder and add the below code to the file:\n\n```js\nimport * as LottiePlayer from \"@lottiefiles/lottie-player\";\n```  \n\\\nOpen `nuxt.config.js` file and add the following entry to register the newly created plugin:\n\n```js\nexport default {\n  plugins: [{ src: \"~/plugins/lottie-player.js\", mode: \"client\" }]\n}\n```\n\nThis is because the player script needs to be rendered on the browser/client side and we must configure Nuxt to load the script on the client side only.  \n\\\nYou would then be able to use the player as follows inside any component:\n\n```html\n\u003clottie-player\n  autoplay\n  controls\n  loop\n  style=\"width:400px\"\n  src=\"https://assets3.lottiefiles.com/packages/lf20_RItkEz.json\"\n  speed=\"1\"\n  debug\n/\u003e\n```\n\n### Nuxt 3\n\nThe process for Nuxt 3 is slightly different.  \nCreate a `lottie-player.client.ts` file inside the `/plugins` folder and add the below code to the file:\n\n```js\nimport * as LottiePlayer from \"@lottiefiles/lottie-player\";\n\nexport default defineNuxtPlugin(() =\u003e LottiePlayer);\n```\n\\\nYour plugin will be automatically available throughout your Nuxt application thanks to the [plugin auto-registration](https://v3.nuxtjs.org/guide/directory-structure/plugins). Note the `client` suffix in the name of the plugin - this tells Nuxt to load it only on the client side, as the Lottie Player script can only be rendered in the browser.\n\nYou would then be able to use the player as follows inside any component:\n\n```html\n\u003clottie-player\n  autoplay\n  controls\n  loop\n  style=\"width:400px\"\n  src=\"https://assets3.lottiefiles.com/packages/lf20_RItkEz.json\"\n  speed=\"1\"\n  debug\n/\u003e\n```\n\n### NextJS\n\nThe process to import in NextJS is similar to Nuxt in the sense that on SSR mode, the library must be declared as a client side module. To do this, import the library within a react useEffect hook.\n\n```javascript\nimport React, { useRef } from \"react\";\n\nexport default function Home() {\n  const ref = useRef(null);\n  React.useEffect(() =\u003e {\n    import(\"@lottiefiles/lottie-player\");\n  });\n  return (\n    \u003cdiv className={styles.container}\u003e\n      \u003cmain className={styles.main}\u003e\n        \u003clottie-player\n          id=\"firstLottie\"\n          ref={ref}\n          autoplay\n          controls\n          loop\n          mode=\"normal\"\n          src=\"https://assets4.lottiefiles.com/packages/lf20_gb5bmwlm.json\"\n          style={{ width: \"300px\", height: \"300px\" }}\n        \u003e\u003c/lottie-player\u003e\n      \u003c/main\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\nDo add a declaration file named declaration.d.ts to the root of the project as well\n\n```javascript\ndeclare namespace JSX {\n  interface IntrinsicElements {\n    \"lottie-player\": any;\n  }\n}\n```\n\nFull documentation on player properties, methods, events and styling for the Lottie-player are available [here](https://docs.lottiefiles.com/lottie-player).\n\n## Community \u0026 Support\n\n- [Github issues.](https://github.com/LottieFiles/lottie-player/issues) For bugs and errors you encounter using this player.\n- [Discord.](https://lottiefiles.com/discord) For hanging out with the community and sharing your awesome Lottie animations!\n\n## Our other Lottie related libraries\n\n\u003ctable style=\"table-layout:fixed; white-space: nowrap;\"\u003e\n  \u003ctr\u003e\n    \u003cth\u003eProject\u003c/th\u003e\n    \u003cth\u003eDescription\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003c!-- TEMPLATE FOR NEW ROW --\u003e\n  \u003c!-- START ROW\n  \u003ctr\u003e\n    \u003ctd\u003elang\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"\" target=\"_blank\" rel=\"noopener noreferrer\"\u003esupabase-lang\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  END ROW --\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ca href=\"https://github.com/LottieFiles/lottie-react\" target=\"_blank\" rel=\"noopener noreferrer\"\u003elottie-react\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e\n    A React component for the Lottie Web player.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ca href=\"https://github.com/LottieFiles/lottie-vue\" target=\"_blank\" rel=\"noopener noreferrer\"\u003elottie-vue\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e\n    A Vue component for the Lottie player.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ca href=\"https://github.com/LottieFiles/svelte-lottie-player\" target=\"_blank\" rel=\"noopener noreferrer\"\u003esvelte-lottie-player\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e\n    Lottie player component for use with Svelte.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ca href=\"https://github.com/LottieFiles/jlottie\" target=\"_blank\" rel=\"noopener noreferrer\"\u003ejLottie\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e\n    jLottie is suitable as a general purpose lottie player, though implements a subset of the features in the core player - this approach leads to a tiny footprint and great performance.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ca href=\"https://github.com/LottieFiles/lottie-interactivity\" target=\"_blank\" rel=\"noopener noreferrer\"\u003elottie-interactivity\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e\n    This is a small library to add scrolling, cursor interactivity and interaction chaining to your Lottie Animations.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ca href=\"https://github.com/orgs/dotlottie/repositories\" target=\"_blank\" rel=\"noopener noreferrer\"\u003edotLottie\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e\n    dotLottie is an open-source file format that aggregates one or more Lottie files and their associated resources into a single file. They are ZIP archives compressed with the Deflate compression method and carry the file extension of \".lottie\".\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ca href=\"https://github.com/LottieFiles/lottie-js\" target=\"_blank\" rel=\"noopener noreferrer\"\u003elottie-js\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e\n    The library consists of methods to map the Lottie JSON to the object model and interact with properties as well as manipulate them.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ca href=\"https://github.com/LottieFiles/lottie-theming\" target=\"_blank\" rel=\"noopener noreferrer\"\u003elottie-theming\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e\n    A library to extract themable properties and apply different themes to a given Lottie\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\n\u003c/table\u003e\n\n## License\n\nMIT License © LottieFiles.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flottiefiles%2Flottie-player","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flottiefiles%2Flottie-player","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flottiefiles%2Flottie-player/lists"}