> For the complete documentation index, see [llms.txt](/llms.txt).

- Snap
- Restricted

# snap_dialog

Display a [dialog](https://metamask-docs-git-imp-agt-scr-90-100-consensys-ddffed67.vercel.app/snaps/features/custom-ui/dialogs/)in the MetaMask UI.

- `type` - The type of dialog. Not providing a type will create a fully [custom dialog](https://metamask-docs-git-imp-agt-scr-90-100-consensys-ddffed67.vercel.app/snaps/features/custom-ui/dialogs/#display-a-custom-dialog). Possible values are:

  - `alert` - An alert that can only be acknowledged.
  - `confirmation` - A confirmation that can be accepted or rejected.
  - `prompt` - A prompt where the user can enter a text response.
- One of:

  - `content` - The content of the alert, as a [custom UI](https://metamask-docs-git-imp-agt-scr-90-100-consensys-ddffed67.vercel.app/snaps/features/custom-ui/) component.
  - `id` - The ID of an [interactive interface](https://metamask-docs-git-imp-agt-scr-90-100-consensys-ddffed67.vercel.app/snaps/reference/snaps-api/snap%5Fcreateinterface).
- `placeholder` - An optional placeholder text to display in the dialog. Only applicable for the `prompt` dialog.

## Parameters[​](#parameters "Direct link to Parameters")

union

An object containing the contents of the dialog.

### Options

union

An alert dialog.

### Options

object

required

### content

JSXElement

required

The content to display in the alert dialog.

or

object

required

### id

string

required

The Snap interface ID, which can be used to display a previously created interface. See [snap_createInterface](https://metamask-docs-git-imp-agt-scr-90-100-consensys-ddffed67.vercel.app/snaps/reference/snaps-api/snap%5Fcreateinterface).

### Common properties

### type

"alert"

required

The literal string "alert" to indicate that this is an alert dialog.

or

union

A confirmation dialog.

### Options

object

required

### content

JSXElement

required

The content to display in the confirmation dialog.

or

object

required

### id

string

required

The Snap interface ID, which can be used to display a previously created interface. See [snap_createInterface](https://metamask-docs-git-imp-agt-scr-90-100-consensys-ddffed67.vercel.app/snaps/reference/snaps-api/snap%5Fcreateinterface).

### Common properties

### type

"confirmation"

required

The literal string "confirmation" to indicate that this is a confirmation dialog.

or

union

A prompt dialog.

### Options

object

required

### content

JSXElement

required

The content to display in the prompt dialog.

or

object

required

### id

string

required

The Snap interface ID, which can be used to display a previously created interface. See [snap_createInterface](https://metamask-docs-git-imp-agt-scr-90-100-consensys-ddffed67.vercel.app/snaps/reference/snaps-api/snap%5Fcreateinterface).

### Common properties

### type

"prompt"

required

The literal string "prompt" to indicate that this is a prompt dialog.

### placeholder

string

An optional placeholder text to display in the text input.

or

union

### Options

object

required

### id

string

required

or

object

required

### content

JSXElement

required

## Returns[​](#returns "Direct link to Returns")

JSON

- If the dialog is an `alert`, the result is `null`.
- If the dialog is a `confirmation`, the result is a boolean indicating whether the user confirmed the dialog.
- If the dialog is a `prompt`, the result is the value entered by the user.

## Example

```
import { Box, Heading, Text } from '@metamask/snaps-sdk/jsx'

const walletAddress = await snap.request({
  method: 'snap_dialog',
  params: {
    type: 'prompt',
    content: (
      <Box>
        <Heading>What is the wallet address?</Heading>
        <Text>Please enter the wallet address to be monitored.</Text>
      </Box>
    ),
    placeholder: '0x123...',
  },
})

// `walletAddress` will be a string containing the address entered by the
// user.

```
