> ## Documentation Index
> Fetch the complete documentation index at: https://api.fanvue.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# UndoAlertPrompt

> A compact, auto-dismissing confirmation with a single undo action.

```tsx theme={null}
import { UndoAlertPrompt } from "@fanvue/ui";
import type { UndoAlertPromptProps, UndoAlertPromptType } from "@fanvue/ui";
```

## Examples

## Action Copy

[UndoAlertPrompt — Action Copy](https://main--697a1b6dd4dad73ee9c0e5f5.chromatic.com/iframe.html?id=components-undoalertprompt--action-copy\&viewMode=story\&shortcuts=false\&singleStory=true\&globals=theme:light)

```tsx theme={null}
import { UndoAlertPrompt } from "@fanvue/ui";

const ACTION_EXAMPLES = [
  { type: "positive", title: "Template Moved" },
  { type: "positive", title: "Post Scheduled" },
  { type: "positive", title: "3 Messages Archived" },
  { type: "removed", title: "Folder Deleted" },
  { type: "removed", title: "Media Removed from Vault" },
  { type: "removed", title: "Draft Discarded" },
] as const;

<div className="flex flex-col items-start gap-3">
  {ACTION_EXAMPLES.map((example) => (
    <UndoAlertPrompt
      key={example.title}
      onUndo={() => {}}
      open
      type={example.type}
      title={example.title}
    />
  ))}
</div>
```

## All Types

[UndoAlertPrompt — All Types](https://main--697a1b6dd4dad73ee9c0e5f5.chromatic.com/iframe.html?id=components-undoalertprompt--all-types\&viewMode=story\&shortcuts=false\&singleStory=true\&globals=theme:light)

```tsx theme={null}
import { UndoAlertPrompt } from "@fanvue/ui";

<div className="flex flex-col items-start gap-3">
  <UndoAlertPrompt title="Template Moved" onUndo={() => {}} open type="positive" />
  <UndoAlertPrompt title="Template Moved" onUndo={() => {}} open type="removed" />
</div>
```

## Positive

[UndoAlertPrompt — Positive](https://main--697a1b6dd4dad73ee9c0e5f5.chromatic.com/iframe.html?id=components-undoalertprompt--positive\&viewMode=story\&shortcuts=false\&singleStory=true\&globals=theme:light)

```tsx theme={null}
import { UndoAlertPrompt } from "@fanvue/ui";

<UndoAlertPrompt title="Template Moved" onUndo={() => {}} open type="positive" />
```

## Custom Label

[UndoAlertPrompt — Custom Label](https://main--697a1b6dd4dad73ee9c0e5f5.chromatic.com/iframe.html?id=components-undoalertprompt--custom-label\&viewMode=story\&shortcuts=false\&singleStory=true\&globals=theme:light)

```tsx theme={null}
import { UndoAlertPrompt } from "@fanvue/ui";

<UndoAlertPrompt
  title="Message Unsent"
  onUndo={() => {}}
  open
  type="removed"
  undoLabel="Restore"
/>
```

## Removed

[UndoAlertPrompt — Removed](https://main--697a1b6dd4dad73ee9c0e5f5.chromatic.com/iframe.html?id=components-undoalertprompt--removed\&viewMode=story\&shortcuts=false\&singleStory=true\&globals=theme:light)

```tsx theme={null}
import { UndoAlertPrompt } from "@fanvue/ui";

<UndoAlertPrompt title="Folder Deleted" onUndo={() => {}} open type="removed" />
```

## Props

## UndoAlertPrompt

A compact, auto-dismissing confirmation with a single undo action. Use it straight after a reversible change, such as moving or deleting an item, so the user can reverse it without leaving their flow. The copy is not fixed: pass a `title` describing the action that just happened, and pick `type` by outcome (`removed` for deletions, `positive` for everything else).

Use inside a `ToastProvider` with a `ToastViewport`.

**onUndo** `() =\> void` *required*

Called when the user activates the undo button. The prompt closes afterwards.

**title** `ReactNode` *required*

Confirmation of the action that just completed. Write it for the action being undone, e.g. "Folder deleted", "Template moved" or "3 messages archived". Accepts rich content for emphasising an item name.

**asChild** `boolean`

**type** `"positive" | "removed"` (default: positive)

Outcome being confirmed. Drives the leading icon.

**undoAltText** `string` (default: undoLabel)

Describes an alternative way to undo, announced to screen reader users who cannot reach the button before the prompt dismisses. Word it for the action, e.g. "Restore the folder from Recently deleted".

**undoLabel** `string` (default: Undo)

Label for the undo button.

## Exported types

Also exported from `@fanvue/ui`: `UndoAlertPromptProps`, `UndoAlertPromptType`.

***

**Setup:** [Installation](https://api.fanvue.com/docs/ui/installation.md) · [Theming](https://api.fanvue.com/docs/ui/theming.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.