{"id":26737311,"url":"https://github.com/denchiklut/transitions-kit","last_synced_at":"2025-04-14T13:33:06.120Z","repository":{"id":65470808,"uuid":"518581259","full_name":"denchiklut/transitions-kit","owner":"denchiklut","description":"A set of predefined transition components build on top of react-transition-gorup","archived":false,"fork":false,"pushed_at":"2025-03-02T17:48:39.000Z","size":30472,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T02:44:21.447Z","etag":null,"topics":["accordion","collapse","react","slide","transition","zoom"],"latest_commit_sha":null,"homepage":"https://denchiklut.github.io/transitions-kit","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/denchiklut.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2022-07-27T19:04:57.000Z","updated_at":"2025-03-02T17:48:02.000Z","dependencies_parsed_at":"2024-01-11T16:28:43.124Z","dependency_job_id":"5b053d5f-280b-43ec-9304-f4c15e2debe6","html_url":"https://github.com/denchiklut/transitions-kit","commit_stats":{"total_commits":36,"total_committers":1,"mean_commits":36.0,"dds":0.0,"last_synced_commit":"91ff58480bb8ee619db2b21a47b721962136cdd6"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denchiklut%2Ftransitions-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denchiklut%2Ftransitions-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denchiklut%2Ftransitions-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denchiklut%2Ftransitions-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denchiklut","download_url":"https://codeload.github.com/denchiklut/transitions-kit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248888826,"owners_count":21178113,"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":["accordion","collapse","react","slide","transition","zoom"],"created_at":"2025-03-28T02:39:30.262Z","updated_at":"2025-04-14T13:33:05.941Z","avatar_url":"https://github.com/denchiklut.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## TransitionsKit\n\n[![NPM Version](https://img.shields.io/npm/v/transitions-kit)](https://www.npmjs.com/package/transitions-kit) \n[![storybook](https://img.shields.io/badge/Storybook-FF4785?logo=storybook\u0026logoColor=white)](https://denchiklut.github.io/transitions-kit) \n[![NPM Downloads](https://img.shields.io/npm/dw/transitions-kit)](https://www.npmjs.com/package/transitions-kit) \n[![GitHub Repo stars](https://img.shields.io/github/stars/denchiklut/transitions-kit)](https://github.com/denchiklut/transitions-kit?tab=readme-ov-file)\n\n\nA set of predefined transition components build on top of `react-transition-gorup`\nImplementation is based on Mui source code.\n\n[![Edit transitions-kit](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/p/sandbox/transitions-kit-fr6dgx)\n\n## Installation\n ```\n npm i transitions-kit\n ```\nOr via yarn\n```\nyarn add transitions-kit\n```\n\n## Usage example\n\n### Fade, Slide, Collapse, Grow, Blur:\n\n```tsx\nimport { Fade, Slide, Collapse, Grow, Blur } from 'transitions-kit';\nimport { useState } from 'react'\n\nexport default function() {\n  const [open, setOpen] = useState(false)\n    \n  return (\n    \u003cdiv\u003e\n      \u003cbutton onClick={() =\u003e setOpen(!open)}\u003etoggle\u003c/button\u003e\n      \n      \u003cFade in={open} mountOnEnter unmountOnExit\u003e\n        \u003cimg src='https://picsum.photos/400' /\u003e\n      \u003c/Fade\u003e\n    \u003c/div\u003e\n    )\n}\n```\n\n## `\u003cTransitionGroup /\u003e`\nTo animate a component when it is mounted or unmounted, you can use the `\u003cTransitionGroup /\u003e` component from `react-transition-group`. As components are added or removed, the in prop is toggled automatically by TransitionGroup.\n\n```tsx\nimport { Collapse } from 'transitions-kit'\nimport { TransitionGroup } from 'react-transition-group'\nimport { useState } from 'react'\n\n\nconst FRUITS = [\n  '🍏 Apple',\n  '🍌 Banana',\n  '🍍 Pineapple',\n  '🥥 Coconut',\n  '🍉 Watermelon'\n];\n\nexport default function() {\n  const [fruitsInBasket, setFruitsInBasket] = useState(FRUITS.slice(0, 3))\n\n  const handleAddFruit = () =\u003e {\n    const nextHiddenItem = FRUITS.find((i) =\u003e !fruitsInBasket.includes(i))\n    \n    if (nextHiddenItem) {\n      setFruitsInBasket((prev) =\u003e [nextHiddenItem, ...prev])\n    }\n  }\n\n  const handleRemoveFruit = (item: string) =\u003e {\n    setFruitsInBasket((prev) =\u003e [...prev.filter((i) =\u003e i !== item)])\n  }\n  \n  return (\n    \u003cdiv\u003e\n      \u003cbutton\n        disabled={fruitsInBasket.length \u003e= FRUITS.length}\n        onClick={handleAddFruit}\n      \u003e\n        Add fruit to basket\n      \u003c/button\u003e\n    \n      \u003cul\u003e\n        \u003cTransitionGroup\u003e\n          {fruitsInBasket.map((item) =\u003e (\n            \u003cCollapse key={item}\u003e\n              \u003cli\u003e\n                {item}\n                \u003cbutton onClick={() =\u003e handleRemoveFruit(item)}\u003ex\u003c/button\u003e\n              \u003c/li\u003e\n            \u003c/Collapse\u003e\n          ))}\n        \u003c/TransitionGroup\u003e\n      \u003c/ul\u003e\n    \u003c/div\u003e\n  )\n}\n```\n\n## Props\nTo get more information visit the `react-transition-group` Transition [documentation](https://reactcommunity.org/react-transition-group/transition).\n\n| Property       | Type                                                           | Description                                                                                                                                                                                                  |\n|----------------|----------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| children       | `ReactElement`                                                 | A single child content element.                                                                                                                                                                              |\n| in             | `Boolean`                                                      | If true, the component will transition in.                                                                                                                                                                   |\n| mountOnEnter   | `Boolean`                                                      | Set to `true` If you want to `\"lazy mount\"` the component on the first in={true}                                                                                                                             |\n| unmountOnExit  | `Boolean`                                                      | Set to `true` if you'd prefer to `unmount` the component after it finishes exiting.                                                                                                                          |\n| easing         | `{ enter?: string, exit?: string } \\| string`                  | The transition timing function. You may specify a single easing or a object containing enter and exit values                                                                                                 |\n| timeout        | `number \\| { appear?: number, enter?: number, exit?: number }` | The duration for the transition, in milliseconds. You may specify a single timeout for all transitions, or individually with an object.                                                                      |\n| appear         | `Boolean`                                                      | Perform the enter transition when it first mounts if in is also true. Set this to false to disable this behavior.                                                                                            |\n| addEndListener | `Function`                                                     | Add a custom transition end trigger. Called with the transitioning DOM node and a done callback. Allows for more fine grained transition end logic. Note: Timeouts are still used as a fallback if provided. |                                                                |                                                                                                                                         |\n\n## Child requirements\n- Forward the ref: The transition components require the first child element to forward its ref to the DOM node.\n- Single element: The transition components require only one child element (React.Fragment is not allowed).\n\n---\n\n## `\u003cCollapse /\u003e`\n```tsx\nimport { Collapse } from 'transitions-kit';\nimport { useState } from 'react'\n\nexport default function() {\n  const [open, setOpen] = useState(false)\n\n  return (\n    \u003cdiv\u003e\n      \u003cbutton onClick={() =\u003e setOpen(!open)}\u003etoggle\u003c/button\u003e\n\n      \u003cCollapse in={open} orientation='vertical' collapsedSize='0px'\u003e\n        \u003cimg src='https://picsum.photos/400' /\u003e\n      \u003c/Collapse\u003e\n    \u003c/div\u003e\n  )\n}\n```\n\n### Collapse's specific props:\n| Property      | Type                     | Description                                                                  |\n|---------------|--------------------------|------------------------------------------------------------------------------|\n| orientation   | `horizontal \\| vertical` | The transition orientation.                                                  |\n| collapsedSize | `number \\| string`       | The width (horizontal) or height (vertical) of the container when collapsed. |\n\n---\n\n## `\u003cSlide /\u003e`\n### Slide relative to a container\n\nThe Slide component also accepts `container` prop, which is a reference to a DOM node. If this prop is set, the Slide component will slide from the edge of that DOM node.\n\n```tsx\nimport { Slide } from 'transitions-kit';\nimport { useState } from 'react'\n\nexport default function() {\n  const [open, setOpen] = useState(false)\n  const ref = useRef\u003cHTMLDivElement\u003e(null)\n  \n  return (\n    \u003cdiv\u003e\n      \u003cbutton onClick={() =\u003e setOpen(!open)}\u003etoggle\u003c/button\u003e\n    \n      \u003cdiv\u003e\n        \u003cp\u003eShow from target\u003c/p\u003e\n        \u003cdiv\n          ref={ref}\n          style={{\n            border: '1px solid', overflow: 'hidden',\n            height: 200, width: 200, padding: 10,\n          }}\n        \u003e\n          \u003cSlide in={open} direction='right' container={ref.current}\u003e\n            \u003cimg src='https://picsum.photos/180' /\u003e\n          \u003c/Slide\u003e\n        \u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n  )\n}\n```\n\n### Slide's specific props:\n| Property  | Type                                  | Description                                                                                                      |\n|-----------|---------------------------------------|------------------------------------------------------------------------------------------------------------------|\n| container | `HTML element \\| func`                | An HTML element, or a function that returns one. It's used to set the container the Slide is transitioning from. |\n| direction | `'down' \\| 'left' \\| 'right' \\| 'up'` | Direction the child node will enter from.                                                                        |\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenchiklut%2Ftransitions-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenchiklut%2Ftransitions-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenchiklut%2Ftransitions-kit/lists"}