# @gluestack-ui/modal

> A universal headless modal component for React Native, Next.js & React

Latest version **0.1.41** (published 2025-03-11) · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: stale.

## Facts

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

## Links

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

## Dependencies (7)

- [@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/overlays](https://npm.io/package/@react-native-aria/overlays.md) ^0.3.15
- [@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.41 (latest) — 2025-03-11
- 0.1.17-alpha.1 (alpha) — 2023-07-25
- 0.1.40 — 2025-03-03
- 0.1.39 — 2025-02-19
- 0.1.38 — 2025-02-18
- 0.1.37 — 2025-02-18
- 0.1.36 — 2025-02-18
- 0.1.35 — 2024-11-11
- 0.1.34 — 2024-07-08
- 0.1.33 — 2024-06-11
- 0.1.32 — 2024-04-05
- 0.1.31 — 2024-03-21
- 0.1.30 — 2024-03-18
- 0.1.29 — 2024-02-12
- 0.1.28 — 2023-12-27
- … 30 more at https://npm.io/package/@gluestack-ui/modal/versions

## README

# `@gluestack-ui/modal`

A Modal is a window on top of the primary content to draw the user's attention to important information or actions. It provides a focused and interruptive way to interact with the application.

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

## Usage

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

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

// import the createModal function
import { createModal } from '@gluestack-ui/modal';

// Understanding the API
const Modal = createModal({
  Root,
  Content,
  CloseButton,
  Header,
  Footer,
  Body,
  Backdrop,
  AnimatePresence: styled.Component, // Can be AnimatePresence from the library you are using
});

// Using the modal component
export default () => (
  <Modal>
    <ModalBackdrop />
    <ModalContent>
      <ModalHeader>
        <Heading>Confirm your request</Heading>
        <ModalCloseButton>
          <CloseIcon />
        </ModalCloseButton>
      </ModalHeader>
      <ModalBody>
        <Text>Modal Body</Text>
      </ModalBody>
      <ModalFooter>
        <Button>
          <ButtonText></ButtonText>
        </Button>
        <Button>
          <ButtonText></ButtonText>
        </Button>
      </ModalFooter>
    </ModalContent>
  </Modal>
);
```

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

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