@react-md/transition v5.1.6
@react-md/transition
Create simple CSS transitions using the provided transition hooks and components utilizing the default transition timing functions. This package also provides a collapse transition, scaling transition, vertical only scaling transition, and a new page transition named cross fade.
Provided components and hooks:
CollapseoruseCollapseTransition- transition an element in and out of view based on the height of the elementCrossFadeoruseCrossFadeTransition- a transition generally used for a full page transition that fades and slightly moves a child component into viewScaleTransitionoruseScaleTransition- transition an element in and out of view with ascaletransform that can be updated to just bescaleYuseTransition- a hook implementation of theTransitioncomponent fromreact-transition-groupCSSTransitionoruseCSSTransition- allows for a CSS transition that was heavily inspired byreact-transition-groupuseFixedPositioning- hooks into theCSSTransitioncomponent from to fix an element to another element within the viewport
The rmd-transition-shadow-transition mixin allows you to "performantly"
transition between two box shadow values using the
opacity trick. This
mixin automatically creates a pseudo ::before or ::after element with the
final box shadow and animates the opacity once one of the $active-selectors
are triggered. The code below will help explain this part a bit more.
Installation
npm install --save @react-md/transitionIt is also recommended to install the following packages as they work hand-in-hand with this package:
npm install --save @react-md/theme \
@react-md/utilsDocumentation
You should check out the full documentation for live examples and more customization information, but an example usage is shown below.
Usage
import type { useState } from "react";
import { render } from "react-dom";
import { Button } from "@react-md/button";
import { Collapse } from "@react-md/transition";
const App = () => {
const [collapsed, setCollapsed] = useState(true);
return (
<>
<Button onClick={() => setCollapsed(!collapsed)}>Toggle</Button>
<Collapse collapsed={collapsed}>
<div>This is my collapsible content!</div>
</Collapse>
</>
);
};
render(<App />, document.getElementById("root"));2 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago