# @react-md/transition

> A package for working with react-md to use some simple transitions.

Latest version **5.1.6** (published 2023-12-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @react-md/transition
pnpm add @react-md/transition
yarn add @react-md/transition
bun add @react-md/transition
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 5.1.6 |
| Published | 2023-12-11 |
| First published | 2019-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 373 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2324 |
| Author | Mikkel Laursen |
| Maintainers | mlaursen |
| Keywords | react-md, material design, react, transition, component, components, collapse |

## Links

- npm: https://www.npmjs.com/package/@react-md/transition
- Repository: https://github.com/mlaursen/react-md
- Homepage: https://react-md.dev/packages/transition/demos
- Issues: https://github.com/mlaursen/react-md/issues
- npm.io page: https://npm.io/package/@react-md/transition

## Dependencies (4)

- [classnames](https://npm.io/package/classnames.md) ^2.3.1
- [@react-md/theme](https://npm.io/package/@react-md/theme.md) ^5.1.6
- [@react-md/utils](https://npm.io/package/@react-md/utils.md) ^5.1.6
- [@react-md/portal](https://npm.io/package/@react-md/portal.md) ^5.1.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 5.1.6 (latest) — 2023-12-11
- 3.0.1-alpha.2 (next) — 2021-08-15
- 5.1.3 — 2022-05-07
- 5.1.2 — 2022-04-02
- 5.1.0 — 2022-03-18
- 5.0.0 — 2022-01-31
- 4.0.3 — 2022-01-01
- 4.0.1 — 2021-11-27
- 4.0.0 — 2021-11-24
- 3.1.0 — 2021-09-10
- 3.0.1 — 2021-08-15
- 3.0.1-alpha.1 — 2021-08-15
- 3.0.1-alpha.0 — 2021-08-15
- 3.0.0 — 2021-08-13
- 3.0.0-alpha.0 — 2021-08-11
- … 47 more at https://npm.io/package/@react-md/transition/versions

## README

# @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:

- `Collapse` or `useCollapseTransition` - transition an element in and out of
  view based on the height of the element
- `CrossFade` or `useCrossFadeTransition` - a transition generally used for a
  full page transition that fades and slightly moves a child component into view
- `ScaleTransition` or `useScaleTransition` - transition an element in and out
  of view with a `scale` transform that can be updated to just be `scaleY`
- `useTransition` - a hook implementation of the `Transition` component from
  `react-transition-group`
- `CSSTransition` or `useCSSTransition` - allows for a CSS transition that was
  heavily inspired by `react-transition-group`
- `useFixedPositioning` - hooks into the `CSSTransition` component 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](http://tobiasahlin.com/blog/how-to-animate-box-shadow/). 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

```sh
npm install --save @react-md/transition
```

It is also recommended to install the following packages as they work
hand-in-hand with this package:

```sh
npm install --save @react-md/theme \
  @react-md/utils
```

<!-- DOCS_REMOVE -->

## Documentation

You should check out the
[full documentation](https://react-md.dev/packages/transition/demos) for live
examples and more customization information, but an example usage is shown
below.

<!-- DOCS_REMOVE_END -->

## Usage

```tsx
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"));
```

---
_Source: https://npm.io/package/@react-md/transition · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
