{"id":20735879,"url":"https://github.com/felipethome/react-inline-transition-group","last_synced_at":"2025-11-01T08:03:26.452Z","repository":{"id":65412062,"uuid":"59259287","full_name":"felipethome/react-inline-transition-group","owner":"felipethome","description":"React component that helps to control CSS transitions defined with inline style.","archived":false,"fork":false,"pushed_at":"2018-12-19T18:25:15.000Z","size":1175,"stargazers_count":43,"open_issues_count":1,"forks_count":8,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-30T04:41:28.527Z","etag":null,"topics":["animation","inline-styles","react","reactcsstransitiongroup"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/felipethome.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2016-05-20T02:42:04.000Z","updated_at":"2023-03-23T07:11:01.000Z","dependencies_parsed_at":"2023-01-23T10:55:02.446Z","dependency_job_id":null,"html_url":"https://github.com/felipethome/react-inline-transition-group","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipethome%2Freact-inline-transition-group","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipethome%2Freact-inline-transition-group/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipethome%2Freact-inline-transition-group/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipethome%2Freact-inline-transition-group/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felipethome","download_url":"https://codeload.github.com/felipethome/react-inline-transition-group/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249748384,"owners_count":21319819,"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","inline-styles","react","reactcsstransitiongroup"],"created_at":"2024-11-17T05:40:24.656Z","updated_at":"2025-11-01T08:03:26.378Z","avatar_url":"https://github.com/felipethome.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Inline Transition Group\n\nThis component helps you to control transitions defined with inline styles. Built with [ReactTransitionHooks](https://github.com/felipethome/react-transition-hooks), the goal is to supply a more up-to-date alternative to [ReactCSSTransitionGroup](https://facebook.github.io/react/docs/animation.html).\n\n[![Build Status](https://travis-ci.org/felipethome/react-inline-transition-group.svg?branch=master)](https://travis-ci.org/felipethome/react-inline-transition-group) [![Coverage Status](https://coveralls.io/repos/github/felipethome/react-inline-transition-group/badge.svg)](https://coveralls.io/github/felipethome/react-inline-transition-group)\n\n## Advantages\n\n* You don't need to decouple your styles from the component.\n* You don't need to supply timeout properties as in *ReactCSSTransitionGroup*.\n* You have callbacks to control the start and end of your transitions for each child.\n* *ReactCSSTransitionGroup* uses timeouts to control the animations which means some situations can break its behavior, like in frame rates lower than 60fps.\n* *ReactCSSTransitionGroup* uses *ReactTransitionGroup* which means you can't interrupt animations.\n\n## Live Demo\n\nCheck out the [demo](http://felipethome.github.io/react-inline-transition-group/).\n\n## How to install\n\n    npm install react-inline-transition-group\n\n## How to use\n\nImport the component to your project and then wrap the nodes you want to control the transition with it. Example:\n\n```jsx\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport Transition from 'react-inline-transition-group';\n\nexport default class Demo extends React.Component {\n  constructor() {\n    super();\n    this.state = {count: 1};\n  }\n\n  handleAdd = () =\u003e {\n    this.setState((previousState) =\u003e {\n      return {count: previousState.count + 1};\n    });\n  };\n\n  handleRemove = () =\u003e {\n    this.setState((previousState) =\u003e {\n      return {count: Math.max(previousState.count - 1, 0)};\n    });\n  };\n\n  handlePhaseEnd = (phase, id) =\u003e {\n    if (phase === 'leave') console.log(id + ' left');\n  };\n\n  render() {\n    const styles = {\n      container: {\n        width: '500px',\n      },\n\n      base: {\n        width: '100%',\n        height: '50px',\n        background: '#4CAF50',\n        opacity: 0,\n      },\n\n      appear: {\n        opacity: 1,\n        transition: 'all 500ms',\n      },\n\n      leave: {\n        opacity: 0,\n        transition: 'all 250ms',\n      },\n\n      custom: {\n        background: '#3F51B5',\n      },\n    };\n\n    const elems = [];\n\n    // Don't forget that for most React components use array indexes as\n    // keys is a bad idea (but not for this example).\n    for (let i = 0; i \u003c this.state.count; i++)\n      elems.push(\u003cdiv key={i} id={i} style={i % 2 ? styles.custom : {}}\u003e{i}\u003c/div\u003e);\n\n    return (\n      \u003cdiv\u003e\n        \u003cdiv\u003e\n          \u003cbutton onClick={this.handleAdd}\u003eAdd\u003c/button\u003e\n          \u003cbutton onClick={this.handleRemove}\u003eRemove\u003c/button\u003e\n        \u003c/div\u003e\n        \u003cTransition\n          childrenStyles={{\n            base: styles.base,\n            appear: styles.appear,\n            enter: styles.appear,\n            leave: styles.leave,\n          }}\n          onPhaseEnd={this.handlePhaseEnd}\n          style={styles.container}\n        \u003e\n          {elems}\n        \u003c/Transition\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n\nReactDOM.render(\u003cDemo /\u003e, document.getElementById('container'));\n```\n\nNotice above that `{elems}` are *divs*, but they could be any other React component, just remember to pass the property *style* that your React component is receiving down to the HTML element that will get these styles. Example:\n\n```jsx\nconst SomeComponent = (props) =\u003e (\n  \u003cdiv style={props.style}\u003e\n    {props.children}\n  \u003c/div\u003e\n);\n\nconst App = () =\u003e {\n  const elems = [];\n\n  // Don't worry, you can still apply custom styles to each element.\n  const otherStyle = { ... };\n\n  for (let i = 0; i \u003c this.state.count; i++)\n    elems.push(\u003cSomeComponent style={otherStyle} key={i} id={i}\u003e{i}\u003c/SomeComponent\u003e);\n\n  return (\n    \u003cTransition\n      childrenStyles={{ ... }}\n    \u003e\n      {elems}\n    \u003c/Transition\u003e\n  );\n};\n```\n\n\n## Properties\n\nProperty name | Description\n------------ | -------------\n**component** | String. The component that will wrap all the children. Default: `div`.\n**childrenStyles** | Object. This object has the properties: `base`, `appear`, `enter` and `leave`. Each of these properties is another object containing the styles for the respective phase. The `base` styles are applied to all children in all phases.\n**onPhaseStart** | Function. Callback that will be called with the current phase (`appear`, `enter` or `leave`) and the child `id` when the phase begins, in this order.\n**onPhaseEnd** | Function. Callback that will be called with the current phase (`appear`, `enter` or `leave`) and the child `id` when the phase ends, in this order.\n\n### Notes\n\n1. You can pass an `id` property to your children components and the callback will be called with it so you know exactly for which child the event happened. This `id` is optional.\n\n2. The `onPhaseStart` callback will be called sooner a node is being added or removed to/from the group. If you have a delay in your CSS transition the component will not wait until the delay is complete to call the callback.\n\n3. The `onPhaseEnd` callback will be called when the longest transition time (delay + duration) completes. Notice that if a transition is interrupted this callback will not be called.\n\n## What is meant by phase\n\nThere are three phases in this component (the same as in ReactCSSTransitionGroup):\n\n* **appear**: happens to any child component that is already inside of ReactInlineTransitionGroup at the moment of its creation, or in other words, at the time the ReactInlineTransitionGroup component just mounted.\n\n* **enter**: happens to any child component that is inserted in ReactInlineTransitionGroup after its creation.\n\n* **leave**: happens to any child component that is being removed from ReactInlineTransitionGroup.\n\n## LICENSE\n\nBSD-3","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipethome%2Freact-inline-transition-group","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelipethome%2Freact-inline-transition-group","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipethome%2Freact-inline-transition-group/lists"}