Socket
Socket
Sign inDemoInstall

@types/react-transition-group

Package Overview
Dependencies
3
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/react-transition-group

TypeScript definitions for react-transition-group


Version published
Maintainers
1
Weekly downloads
6,852,807
decreased by-17.33%
Install size
1.57 MB

Weekly downloads

Package description

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

Readme

Source

Installation

npm install --save @types/react-transition-group

Summary

This package contains type definitions for react-transition-group (https://github.com/reactjs/react-transition-group).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-transition-group.

Additional Details

  • Last updated: Tue, 05 Dec 2023 16:38:07 GMT
  • Dependencies: @types/react

Credits

These definitions were written by Karol Janyst, Epskampie, Masafumi Koba, and Ben Grynhaus.

FAQs

Last updated on 05 Dec 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc