# fkhadra/react-toastify architecture

> Architecture diagram of the GitHub repository fkhadra/react-toastify, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fkhadra/react-toastify
- Repository: https://github.com/fkhadra/react-toastify

## Overview

React-Toastify is a React notification library. An application calls the public `toast` API; the core queues or dispatches notifications to registered containers, which observe state and render toast components with interaction, timing, progress, and transition behavior. The README documents additional capabilities such as promise notifications, updates, stacking, RTL, and customization. The graph follows the sampled calls and README capabilities; unsampled subsystem links are omitted where their wiring cannot be verified.

Main entry points: [`src/components/Toast.tsx`](https://github.com/fkhadra/react-toastify/blob/main/src/components/Toast.tsx) (Toast View), [`src/core/store.ts`](https://github.com/fkhadra/react-toastify/blob/main/src/core/store.ts) (Toast Store), [`src/core/toast.ts`](https://github.com/fkhadra/react-toastify/blob/main/src/core/toast.ts) (Toast API), [`src/components/ToastContainer.tsx`](https://github.com/fkhadra/react-toastify/blob/main/src/components/ToastContainer.tsx) (Toast Container)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Public API"]
  node_exports["Library Exports<br/>[index.ts]"]
  node_toastapi["Toast API<br/>[toast.ts]"]
end

subgraph group_state["Toast State"]
  node_store["Toast Store<br/>[store.ts]"]
  node_observer["Container Observer"]
end

subgraph group_ui["Rendering"]
  node_container["Toast Container<br/>[ToastContainer.tsx]"]
  node_containerhook["Container Hook"]
  node_toast["Toast View<br/>[Toast.tsx]"]
  node_close["Close Button<br/>[CloseButton.tsx]"]
  node_progress["Progress Bar<br/>[ProgressBar.tsx]"]
  node_icons["Toast Icons<br/>[Icons.tsx]"]
end

subgraph group_behavior["Interaction &amp; Motion"]
  node_transitions["Transition Components<br/>[Transitions.tsx]"]
  node_toastbehavior["Toast Interaction<br/>[useToast.ts]"]
  node_cssmotion["CSS Transitions<br/>[cssTransition.tsx]"]
  node_collapse["Toast Collapse<br/>[collapseToast.ts]"]
end

subgraph group_extensions["Extensions"]
  node_centerhook["Notification Center Hook"]
  node_playground["Configuration Playground<br/>[App.tsx]"]
end

node_app(("Application"))

node_app -->|"uses API"| node_exports
node_exports -->|"exports"| node_toastapi
node_toastapi -->|"dispatches toast"| node_store
node_container -->|"observes state"| node_containerhook
node_containerhook -->|"registers container"| node_store
node_store -->|"creates observer"| node_observer
node_store -->|"dispatches toast"| node_observer
node_container -->|"renders toasts"| node_toast
node_toast -->|"uses interaction"| node_toastbehavior
node_toast -->|"renders close"| node_close
node_toast -->|"renders progress"| node_progress
node_toast -->|"gets icon"| node_icons
node_toast -->|"renders transition"| node_transitions
node_cssmotion -->|"collapses toast"| node_collapse
node_toastapi -.->|"feeds notifications"| node_centerhook
node_app -->|"configures demo"| node_playground
node_playground -->|"calls toast API"| node_exports
node_app -->|"mounts containers"| node_container
node_app -->|"creates promise toast"| node_toastapi
node_toastbehavior -->|"registers timer"| node_store

click node_exports "https://github.com/fkhadra/react-toastify/blob/main/src/index.ts"
click node_toastapi "https://github.com/fkhadra/react-toastify/blob/main/src/core/toast.ts"
click node_store "https://github.com/fkhadra/react-toastify/blob/main/src/core/store.ts"
click node_observer "https://github.com/fkhadra/react-toastify/blob/main/src/core/containerObserver.ts"
click node_centerhook "https://github.com/fkhadra/react-toastify/blob/main/packages/use-notification-center/src/useNotificationCenter.ts"
click node_container "https://github.com/fkhadra/react-toastify/blob/main/src/components/ToastContainer.tsx"
click node_containerhook "https://github.com/fkhadra/react-toastify/blob/main/src/hooks/useToastContainer.ts"
click node_toast "https://github.com/fkhadra/react-toastify/blob/main/src/components/Toast.tsx"
click node_close "https://github.com/fkhadra/react-toastify/blob/main/src/components/CloseButton.tsx"
click node_progress "https://github.com/fkhadra/react-toastify/blob/main/src/components/ProgressBar.tsx"
click node_icons "https://github.com/fkhadra/react-toastify/blob/main/src/components/Icons.tsx"
click node_transitions "https://github.com/fkhadra/react-toastify/blob/main/src/components/Transitions.tsx"
click node_toastbehavior "https://github.com/fkhadra/react-toastify/blob/main/src/hooks/useToast.ts"
click node_cssmotion "https://github.com/fkhadra/react-toastify/blob/main/src/utils/cssTransition.tsx"
click node_collapse "https://github.com/fkhadra/react-toastify/blob/main/src/utils/collapseToast.ts"
click node_playground "https://github.com/fkhadra/react-toastify/blob/main/playground/src/components/App.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_exports,node_toastapi toneBlue
class node_store,node_observer toneAmber
class node_container,node_containerhook,node_toast,node_close,node_progress,node_icons toneMint
class node_transitions,node_toastbehavior,node_cssmotion,node_collapse toneRose
class node_centerhook,node_playground,node_app toneIndigo
```

## Components

### Public API

- [Library Exports](https://github.com/fkhadra/react-toastify/blob/main/src/index.ts): `src/index.ts`
- [Toast API](https://github.com/fkhadra/react-toastify/blob/main/src/core/toast.ts): `src/core/toast.ts`

### Toast State

- [Toast Store](https://github.com/fkhadra/react-toastify/blob/main/src/core/store.ts): `src/core/store.ts`
- [Container Observer](https://github.com/fkhadra/react-toastify/blob/main/src/core/containerObserver.ts): `src/core/containerObserver.ts`

### Rendering

- [Toast Container](https://github.com/fkhadra/react-toastify/blob/main/src/components/ToastContainer.tsx): `src/components/ToastContainer.tsx`
- [Container Hook](https://github.com/fkhadra/react-toastify/blob/main/src/hooks/useToastContainer.ts): `src/hooks/useToastContainer.ts`
- [Toast View](https://github.com/fkhadra/react-toastify/blob/main/src/components/Toast.tsx): `src/components/Toast.tsx`
- [Close Button](https://github.com/fkhadra/react-toastify/blob/main/src/components/CloseButton.tsx): `src/components/CloseButton.tsx`
- [Progress Bar](https://github.com/fkhadra/react-toastify/blob/main/src/components/ProgressBar.tsx): `src/components/ProgressBar.tsx`
- [Toast Icons](https://github.com/fkhadra/react-toastify/blob/main/src/components/Icons.tsx): `src/components/Icons.tsx`

### Interaction & Motion

- [Transition Components](https://github.com/fkhadra/react-toastify/blob/main/src/components/Transitions.tsx): `src/components/Transitions.tsx`
- [Toast Interaction](https://github.com/fkhadra/react-toastify/blob/main/src/hooks/useToast.ts): `src/hooks/useToast.ts`
- [CSS Transitions](https://github.com/fkhadra/react-toastify/blob/main/src/utils/cssTransition.tsx): `src/utils/cssTransition.tsx`
- [Toast Collapse](https://github.com/fkhadra/react-toastify/blob/main/src/utils/collapseToast.ts): `src/utils/collapseToast.ts`

### Extensions

- [Notification Center Hook](https://github.com/fkhadra/react-toastify/blob/main/packages/use-notification-center/src/useNotificationCenter.ts): `packages/use-notification-center/src/useNotificationCenter.ts`
- [Configuration Playground](https://github.com/fkhadra/react-toastify/blob/main/playground/src/components/App.tsx): `playground/src/components/App.tsx`

### Other components

- **Application**

## Connections

- Application → Library Exports: uses API
- Library Exports → Toast API: exports (evidence: `src/index.ts`)
- Toast API → Toast Store: dispatches toast (evidence: `src/core/toast.ts`)
- Toast Container → Container Hook: observes state (evidence: `src/components/ToastContainer.tsx`)
- Container Hook → Toast Store: registers container (evidence: `src/hooks/useToastContainer.ts`)
- Toast Store → Container Observer: creates observer (evidence: `src/core/store.ts`)
- Toast Store → Container Observer: dispatches toast (evidence: `src/core/store.ts`)
- Toast Container → Toast View: renders toasts (evidence: `src/components/ToastContainer.tsx`)
- Toast View → Toast Interaction: uses interaction (evidence: `src/components/Toast.tsx`)
- Toast View → Close Button: renders close (evidence: `src/components/Toast.tsx`)
- Toast View → Progress Bar: renders progress (evidence: `src/components/Toast.tsx`)
- Toast View → Toast Icons: gets icon (evidence: `src/components/Toast.tsx`)
- Toast View → Transition Components: renders transition (evidence: `src/components/Toast.tsx`)
- CSS Transitions → Toast Collapse: collapses toast (evidence: `src/utils/cssTransition.tsx`)
- Toast API → Notification Center Hook: feeds notifications
- Application → Configuration Playground: configures demo (evidence: `playground/src/components/App.tsx`)
- Configuration Playground → Library Exports: calls toast API (evidence: `playground/src/components/App.tsx`)
- Application → Toast Container: mounts containers
- Application → Toast API: creates promise toast
- Toast Interaction → Toast Store: registers timer (evidence: `src/hooks/useToast.ts`)
