# @gluestack-ui/alert-dialog

> A universal headless alert-dialog component for React Native, Next.js & React

Latest version **0.1.38** (published 2025-03-11) · 41.3K weekly downloads

## Install

```sh
npm install @gluestack-ui/alert-dialog
pnpm add @gluestack-ui/alert-dialog
yarn add @gluestack-ui/alert-dialog
bun add @gluestack-ui/alert-dialog
```

## Health

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

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

Warnings: pre 1.0.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 0.1.38 |
| Published | 2025-03-11 |
| First published | 2023-02-21 |
| Weekly downloads | 41.3K |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 41.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5307 |
| Maintainers | vidhi499, rohit_singh, viraj-10, rayan1810, rajat693, surajahmedc, meenumakkar, madhavb230100, vaibhk002, daminipandey, amars29, geekgautam, sravankumarvelangi, gluestackadmin, geekashwini, mayankp06 |
| Keywords | react, native, react-native, alert-dialog, gluestack-ui, universal, headless, typescript, component, android, ios, nextjs |

## Links

- npm: https://www.npmjs.com/package/@gluestack-ui/alert-dialog
- Repository: https://github.com/gluestack/gluestack-ui
- Homepage: https://github.com/gluestack/gluestack-ui/tree/main/packages/unstyled/alert-dialog#readme
- Issues: https://github.com/gluestack/gluestack-ui/issues
- npm.io page: https://npm.io/package/@gluestack-ui/alert-dialog

## Dependencies (6)

- [@gluestack-ui/hooks](https://npm.io/package/@gluestack-ui/hooks.md) 0.1.13
- [@gluestack-ui/utils](https://npm.io/package/@gluestack-ui/utils.md) ^0.1.15
- [@gluestack-ui/overlay](https://npm.io/package/@gluestack-ui/overlay.md) ^0.1.22
- [@react-native-aria/focus](https://npm.io/package/@react-native-aria/focus.md) ^0.2.9
- [@react-native-aria/dialog](https://npm.io/package/@react-native-aria/dialog.md) ^0.0.5
- [@react-native-aria/interactions](https://npm.io/package/@react-native-aria/interactions.md) 0.2.16

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

- 0.1.38 (latest) — 2025-03-11
- 0.1.12-alpha.0 (alpha) — 2023-07-25
- 0.1.37 — 2025-03-03
- 0.1.36 — 2025-02-19
- 0.1.35 — 2025-02-18
- 0.1.34 — 2025-02-18
- 0.1.33 — 2025-02-18
- 0.1.32 — 2024-11-11
- 0.1.31 — 2024-10-04
- 0.1.30 — 2024-07-08
- 0.1.29 — 2024-06-11
- 0.1.28 — 2024-04-03
- 0.1.27 — 2024-03-21
- 0.1.26 — 2024-03-18
- 0.1.25 — 2024-02-12
- … 25 more at https://npm.io/package/@gluestack-ui/alert-dialog/versions

## README

# `@gluestack-ui/alert-dialog`

AlertDialog effectively interrupts a user's flow and prompts them to take a specific action. It's commonly used for mandatory confirmations or call-to-actions.

## Installation

To install the component, run the following command in your terminal. This will add the component to your project's dependencies and allow you to use it in your project.

```sh
npx gluestack-ui@latest add alert-dialog
```

## Usage

Default styling of all these components can be found in the components/core/Default styling of all these components can be found in the components/core/alert-dialog file. For reference, you can view the [source code](https://github.com/gluestack/gluestack-ui/blob/main/example/storybook/src/ui-components/AlertDialog/styled-components/index.tsx) of the styled AlertDialog components.

```jsx
// import the styles
import {
  Root,
  Content,
  CloseButton,
  Header,
  Footer,
  Body,
  Backdrop,
} from '../components/core/alert-dialog/styled-components';

// import the createAlertDialog function
import { createAlertDialog } from '@gluestack-ui/alert-dialog';

// Understanding the API
const AlertDialog = createAlertDialog({
  Root,
  Content,
  CloseButton,
  Header,
  Footer,
  Body,
  Backdrop,
});

// Using the alert-dialog component
export default () => (
  <AlertDialog>
    <AlertDialogBackdrop />
    <AlertDialogContent>
      <AlertDialogHeader>
        <Heading>Confirm your request</Heading>
        <AlertDialogCloseButton>
          <CloseIcon />
        </AlertDialogCloseButton>
      </AlertDialogHeader>
      <AlertDialogBody>
        <Text>AlertDialog Body</Text>
      </AlertDialogBody>
      <AlertDialogFooter>
        <Button>
          <ButtonText></ButtonText>
        </Button>
        <Button>
          <ButtonText></ButtonText>
        </Button>
      </AlertDialogFooter>
    </AlertDialogContent>
  </AlertDialog>
);
```

More guides on how to get started are available
[here](https://ui.gluestack.io/docs/).

---
_Source: https://npm.io/package/@gluestack-ui/alert-dialog · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
