# Dialog — React Native component for Expo

> A centred alert whose card springs up from 0.92 while its tone icon draws itself.

A centred alert dialog: the scrim fades in while the card springs from 0.92 to full size, with an optional living tone icon that draws itself in a glowing halo. Modern pill buttons or iOS hairline buttons, side by side or stacked; danger-coloured destructive confirms with a warning haptic, async spinners, a prompt field, and a shake when the confirm is invalid. Use Action Sheet for bottom actions.

- Docs: https://expokit.in/docs/components/dialog
- Tier: Free
- Also called: modal, popup, alert dialog, confirm dialog
- Category: Overlays
- Platforms: iOS, Android, web
- Expo Go: yes, no development build needed
- npm dependencies: react-native-svg, expo-haptics
- Uses ExpoKit items: kit
- Variants: Basic, Destructive, With Form, Payment Sent, Sign Out, Three Actions, Action Sheet Demo

## Installation

Run once per project: `npx @expokit/cli@latest init` (shared theme + KitProvider). Then:

```bash
npx @expokit/cli@latest add dialog
```

The CLI copies the source into your project (you own the code) and installs react-native-svg, expo-haptics.

Import: `import { Dialog } from "@/components/ui/dialog";`

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `open / defaultOpen` | `boolean` | `false` | Controlled / uncontrolled visibility. |
| `onOpenChange` | `(open: boolean) => void` | — | Called on scrim tap, back, Escape and actions. |
| `variant` | `"default" \| "destructive"` | `"default"` | Destructive adds a warning icon, a danger confirm and a warning haptic on open. The old "sheet" value is deprecated and renders as default. |
| `tone` | `"info" \| "success" \| "warning" \| "danger"` | — | Living icon in a halo above the title with a soft glow of its colour; success / warning open with a matching haptic. |
| `appearance` | `"modern" \| "ios"` | `"modern"` | Pill buttons, or iOS full-width text buttons split by hairlines. |
| `title / description` | `string` | — | Heading and body copy. |
| `prompt` | `{ defaultValue?, value?, onChangeText?, placeholder?, secureTextEntry?, keyboardType?, maxLength?, … }` | — | Adds a text field (a prompt dialog). Its text is passed to onConfirm / onPress; Return submits. |
| `error` | `string` | — | Error text under the field or description. |
| `children` | `ReactNode` | — | Custom content above the actions. |
| `actions` | `{ label, onPress?, role?, disabled? }[]` | `Cancel + Confirm` | Buttons. role: primary \| default \| destructive \| cancel. onPress(value) may return a promise (spinner) or false (stays open and shakes). |
| `confirmLabel / cancelLabel` | `string / string \| null` | `labels.continue (destructive: labels.delete) / labels.cancel` | Labels for the default buttons; cancelLabel null leaves a single button. |
| `onConfirm / onCancel` | `(value) => void \| false \| Promise · () => void` | — | Handlers for the default buttons (onCancel also fires on scrim, back and Escape). |
| `loading` | `boolean` | `false` | Spinner on the confirm button; other buttons and dismissal are disabled. |
| `actionsLayout` | `"auto" \| "row" \| "stack"` | `"auto"` | Two short buttons side by side, otherwise stacked with Cancel last. |
| `icon` | `ReactNode \| false` | `tone icon` | Custom node inside the halo, or false to hide it. |
| `dismissible` | `boolean` | `true` | Close on scrim tap, back and Escape. |
| `haptics` | `boolean` | `true` | Warning on open for destructive dialogs, success for success, error on shake. |
| `accent` | `string` | `theme primary (accent in ios)` | Colour of the primary action. |
| `style` | `StyleProp<ViewStyle>` | — | Card style. |
| `className` | `string` | — | Tailwind classes on the root when using NativeWind or Uniwind. Prefer style for StyleSheet overrides. |

## Behaviour & accessibility

- **Motion**: The scrim fades in while the card springs to full size. A confirm that returns false keeps it open and shakes it.
- **Reduced motion**: The card fades in without the scale spring, and the tone icon appears fully drawn instead of animating. The shake is skipped.
- **Haptics**: A warning tick on open for destructive, warning and danger dialogs, success for the success tone, and an error buzz on shake.
- **Screen readers**: The title is a header; destructive, warning and danger dialogs use the alert role. Buttons report disabled and busy, and the error text is a polite live region.
- **Keyboard**: Escape closes it on web, and Return submits a prompt field.

## FAQ

### How do I make a modal in React Native?

Use ExpoKit's Dialog: run npx @expokit/cli@latest add dialog in your Expo or React Native project and it copies a ready-made modal into your app as plain TypeScript you can edit. It works on iOS, Android and web, and in Expo Go.

### Does Dialog work in Expo Go?

Yes. Dialog runs in Expo Go on iOS and Android with no development build — its packages (react-native-svg, expo-haptics) are all included in Expo Go.

### How do I add Dialog to my Expo app?

Run npx @expokit/cli@latest add dialog in your project. The CLI copies the component's source into your app and installs react-native-svg, expo-haptics, so the code is yours to change.

### Is Dialog free?

Yes. Dialog is free: its full source is on this page and the CLI installs it without an account.

### Can I change how Dialog looks?

Yes. It takes its colours, radius and light / dark mode from useKit(), so wrapping your app in <KitProvider accent radius> re-skins it with every other ExpoKit component. The code lives in your project, so you can also edit anything directly.

## More

- Live preview, variants and code: https://expokit.in/docs/components/dialog
- Every ExpoKit component, screen, template and chart: https://expokit.in/llms.txt
- Install commands and props for every free component: https://expokit.in/llms-full.txt
- Pricing: https://expokit.in/pricing
