Proposition of builtin CSS transition handlers with react-transition-group
See original GitHub issueMost of the time transitions are hard and messy to perform and maintain, Styled Components bring us a very easy API to handle styling. I was thinking of an idea to add transition helpers to the API levered by react-transition-group and make it even better.
import styled from 'styled-components-transition-group';
// transition() wraps TransitionGroup
const List = styled.div.transition() ``;
// animated() wraps CSSTransition
const ListItem = styled.div.animated() `
transition: opacity 300ms cubic-bezier(0.4, 0.0, 0.2, 1) 0ms;
&:appear, &:enter, &:exit {
opacity: 0;
}
&:appear-active, &:enter-active {
opacity: 1;
}
`;
Access my example repository and launch storybook for a working demo of this proposition.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:11
- Comments:17 (2 by maintainers)
Top Results From Across the Web
CSSTransition Component - React Transition Group
CSSTransition applies a pair of class names during the appear , enter , and exit states of the transition. The first class is...
Read more >Animation Add-Ons - React
ReactCSSTransitionGroup is a high-level API based on ReactTransitionGroup and is an easy way to perform CSS transitions and animations when a React component ......
Read more >Using React Transition Group to improve UI - LogRocket Blog
In this React Transition Group tutorial, learn how to use the CSSTransition and TransitionGroup components in your React app to improve UX.
Read more >Improve your UI with React Transition Group - YouTube
In this video tutorial, we will take a look at React Transition Group to improve transitions in our application.0:00 Introduction 4:24 ...
Read more >An introduction to animated transitions with React Router
React Transition Group is an animation library that gives us a way to perform animations when a React component enters or leaves the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If anyone’s still interested, I made styled-transition-group, which exports a new styled object as geelen proposed.
I’m throwing my hat in the ring. I’ve used a slightly different, more minimal approach: https://github.com/granmoe/styled-animate