# react-animate-z

> Lightweight React animation library with Animate and AnimateTyping components, built using styled-components.

Latest version **3.0.2** (published 2026-02-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-animate-z
pnpm add react-animate-z
yarn add react-animate-z
bun add react-animate-z
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2026-02-07 |
| First published | 2023-05-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 390.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Delpi.Kye |
| Maintainers | delpikye |
| Keywords | react, animation, animate, react-animation, styled-components, motion, ui-animation, css-animation, typing-effect, micro-interactions, react-animate-z |

## Links

- npm: https://www.npmjs.com/package/react-animate-z
- Repository: https://github.com/delpikye-v/react-animate
- Homepage: https://github.com/delpikye-v/react-animate#readme
- Issues: https://github.com/delpikye-v/react-animate/issues
- npm.io page: https://npm.io/package/react-animate-z

## Alternatives

- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K weekly downloads
- [persona-harness](https://npm.io/package/persona-harness.md) — 4.7K weekly downloads
- [@tsparticles/effect-bubble](https://npm.io/package/@tsparticles/effect-bubble.md) — 4.6K weekly downloads
- [f3d](https://npm.io/package/f3d.md) — 730 weekly downloads
- [spark-html-motion](https://npm.io/package/spark-html-motion.md) — 298 weekly downloads

## Recent versions

- 3.0.2 (latest) — 2026-02-07
- 3.0.0-z (z) — 2026-02-05
- 3.0.1 — 2026-02-05
- 3.0.0 — 2026-02-05
- 2.3.0 — 2025-09-18
- 2.2.0 — 2025-09-18
- 2.1.0 — 2025-09-18
- 2.0.0 — 2025-09-18
- 1.1.0 — 2025-06-02
- 1.0.3 — 2024-08-27
- 1.0.2 — 2024-08-26
- 1.0.1 — 2023-05-10
- 1.0.0 — 2023-05-08

## README

# 🎞️ react-animate-z

[![NPM](https://img.shields.io/npm/v/react-animate-z.svg)](https://www.npmjs.com/package/react-animate-z) ![Downloads](https://img.shields.io/npm/dt/react-animate-z.svg)

<a href="https://codesandbox.io/p/devbox/lively-night-lrjs4s" target="_blank">LIVE EXAMPLE</a>


A lightweight, UX-first animation library for React.

**react-animate-z** provides a clean imperative + declarative API to orchestrate animations

---

## ✨ Why react-animate-z

- 🚀 180+ prebuilt animations
- 🧠 Semantic UX states (loading / success / error)
- ⛓️ Timeline API (sequence, parallel, wait)
- 🎯 Ref-based animation (no wrapper required)
- 🎲 Random & playful animation hooks
- ♿ Reduced-motion safe
- 🧩 Fully typed with TypeScript

---

## 📦 Installation

```bash
npm install react-animate-z
# or
yarn add react-animate-z
```

---

## 🚀 Basic Usage (Declarative)

```tsx
import Animate from "react-animate-z";

export default function App() {
  return (
    <Animate type="bounce" duration="1s">
      <h1>Hello Animation</h1>
    </Animate>
  );
}
```

## 🎛️ Animation Catalog
```ts
import { animNames, animGroups } from "react-animate-z";

console.log(animNames);   // all animation names
console.log(animGroups); // grouped by category

```

---

## 🔧 `Animate` Props

| Prop        | Type                   | Default     | Description         |
|-------------|------------------------|-------------|---------------------|
| `type`      | `AnimateType`          | `blurIn`    | Animation name      |
| `duration`  | `string \| number`     | preset map  | `'1s'` or `1000`    |
| `timing`    | `TimingKey`            | `ease`      | CSS timing function |
| `delay`     | `string \| number`     | `0s`        | Delay before start  |
| `iteration` | `number \| "infinite"` | `1`         | Repeat count        |
| `direction` | `string`               | `normal`    | Animation direction |
| `fillMode`  | `string`               | `forwards`  | CSS fill-mode       |
| `tagName`   | `string`               | `div`       | Rendered HTML tag   |

---

## 🎯 Ref-based Animation (Imperative)

```tsx
import { useAnimate } from "react-animate-z";

function Box() {
  const { ref, play } = useAnimate<HTMLDivElement>();

  return (
    <div ref={ref} onClick={() => play("pulse")}>
      Click me
    </div>
  );
}
```

---

## ⛓️ Timeline API

Compose animations as clear motion flows, not nested callbacks.

```tsx
import { useAnimate } from "react-animate-z";
import { useEffect } from "react";

function Example() {
  const { ref, sequence } = useAnimate<HTMLDivElement>();

  useEffect(() => {
    sequence()
      .animate("fadeInFromBottom")
      .wait(300)
      .animate("pulse");
  }, []);

  return <div ref={ref}>Hello</div>;
}
```

---

## 🧠 Semantic Recipes (State-driven UX)

```tsx
import { useRecipe } from "react-animate-z";

function SaveButton() {
  const anim = useRecipe();

  return (
    <button
      ref={anim.ref}
      onClick={async () => {
        anim.loading();
        await save();
        anim.success();
      }}
    >
      Save
    </button>
  );
}
```

Available presets:
- loading()
- success()
- error()
- idle()

---

## 🔁 <AnimateOn /> — Trigger by State Change

```ts
import { AnimateOn } from "react-animate-z";

<AnimateOn when={status} value="success" anim={["fadeIn", "pulse"]}>
  <div>Done!</div>
</AnimateOn>

```

---

## 🧩 AnimateGroup – Staggered Children

```tsx
import { AnimateGroup } from "react-animate-z";

<AnimateGroup type="fadeInUp" stagger={160}>
  <div>Item 1</div>
  <div>Item 2</div>
  <div>Item 3</div>
</AnimateGroup>

```

---

## ⌨️ Typing Animation

```tsx
import { AnimateTyping } from "react-animate-z";

<AnimateTyping
  dataText={[
    "Hello World",
    "React Animate Z",
    "Built for UX",
  ]}
/>
```

---

## 🎲 Random & Playful Motion

```ts
import { useRandomAnimateNoRepeat } from "react-animate-z";

const play = useRandomAnimateNoRepeat(run, [
  "shakeMix",
  "pulse",
  "flash",
  "jelly",
]);

<button onClick={() => play()}>Surprise me</button>

```

---

## 🪄 AnimatePresence (Enter / Exit)

`AnimatePresence` animates mount / unmount using enter / exit animation pairs,
similar to Framer Motion but lighter, CSS-based, and no styled-components dependency.

#### ✅ Use case
- Modal
- Drawer / Sidebar
- Toast / Snackbar
- Tooltip
- Dropdown
- Conditional UI
---

#### 📌 Basic usage

```tsx
import { AnimatePresence } from "react-animate-z";

function Example({ open }: { open: boolean }) {
  return (
    <AnimatePresence
      show={open}
      enter="fadeIn"
      exit="fadeOut"
      duration={300}
    >
      <div>Hello</div>
    </AnimatePresence>
  );
}

```
---

#### 🔥 Example: Modal

```tsx
<AnimatePresence
  show={open}
  enter="zoomIn"
  exit="fadeOut"
  duration={250}
>
  <div className="modal" />
</AnimatePresence>
```

---


#### 🧠 Behavior timeline

```bash
show = false
  └─ nothing rendered

show = true
  └─ mount
      └─ enter animation

show = false
  └─ exit animation
      └─ wait(duration)
          └─ unmount
```

- Declarative intent, not keyframes
- Timeline-based composition
- Ref-first, framework-agnostic core
- Safe defaults for accessibility

---

## 🧩 Additional APIs

#### Components
- AnimateHost: Low-level animation context host, used for coordinating multiple animated elements.
- WrapperAnimate: Conditional animation wrapper without breaking DOM structure.
- TypingText: Lightweight typing animation for inline text (simpler than AnimateTyping).

#### Hooks
- useAnimateController: Imperative control over animation lifecycle (play, stop, reset).
- useAnimateSequence: Timeline logic as a hook for reusable animation flows.
- useRandomAnimateNoRepeat: Random animation helper with no immediate repetition.
- useRecipe: Semantic, state-driven animation (loading, success, error).

> These APIs are intended for advanced or compositional use cases.
> Most applications only need <Animate /> and useAnimate().

---

## 📜 License

MIT

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