Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/react-transition-group

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/react-transition-group

TypeScript definitions for react-transition-group

  • 2.0.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.2M
decreased by-53.14%
Maintainers
1
Weekly downloads
 
Created

What is @types/react-transition-group?

The @types/react-transition-group package provides TypeScript type definitions for the react-transition-group library, which is a React component toolset for managing animations and transitions. It allows developers to define entering and exiting transitions for components in React applications.

What are @types/react-transition-group's main functionalities?

Transition

The Transition component lets you describe a transition from one component state to another over time with a simple declarative API. The example shows a fade effect applied to a component.

{"import React from 'react';\nimport { Transition } from 'react-transition-group';\n\nconst duration = 300;\n\nconst defaultStyle = {\n  transition: `opacity ${duration}ms ease-in-out`,\n  opacity: 0,\n};\n\nconst transitionStyles = {\n  entering: { opacity: 1 },\n  entered:  { opacity: 1 },\n  exiting:  { opacity: 0 },\n  exited:  { opacity: 0 },\n};\n\nconst Fade = ({ in: inProp }) => (\n  <Transition in={inProp} timeout={duration}>\n    {state => (\n      <div style={{\n        ...defaultStyle,\n        ...transitionStyles[state]\n      }}>\n        I'm a fade Transition!\n      </div>\n    )}\n  </Transition>\n);"}

CSSTransition

CSSTransition applies a pair of class names during the appear, enter, and exit states of the transition. The example demonstrates how to use it for a fade effect.

{"import React from 'react';\nimport { CSSTransition } from 'react-transition-group';\n\nconst Fade = ({ in: inProp }) => (\n  <CSSTransition\n    in={inProp}\n    timeout={300}\n    classNames='fade'\n  >\n    <div className='fade'>I'm a fade CSSTransition!</div>\n  </CSSTransition>\n);\n\n// CSS\n.fade-enter {\n  opacity: 0.01;\n}\n.fade-enter-active {\n  opacity: 1;\n  transition: opacity 300ms ease-in;\n}\n.fade-exit {\n  opacity: 1;\n}\n.fade-exit-active {\n  opacity: 0.01;\n  transition: opacity 300ms ease-in;\n}"}

TransitionGroup

TransitionGroup manages a set of transition components (like CSSTransition) in a list. It's useful for animating lists or groups of elements entering and exiting. The example shows a todo list where items fade in and out.

{"import React from 'react';\nimport { TransitionGroup, CSSTransition } from 'react-transition-group';\n\nfunction TodoList({ todos }) {\n  return (\n    <TransitionGroup className='todo-list'>\n      {todos.map(({ id, text }) => (\n        <CSSTransition\n          key={id}\n          timeout={500}\n          classNames='item'\n        >\n          <div>{text}</div>\n        </CSSTransition>\n      ))}\n    </TransitionGroup>\n  );\n}"}

Other packages similar to @types/react-transition-group

FAQs

Package last updated on 09 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc