# snap_dialog

> Reference documentation for the `snap_dialog` method of the Snaps API.

<SnapsAPIReference method={{"name":"snap_dialog","description":"Display a [dialog](https://docs.metamask.io/snaps/features/custom-ui/dialogs/)\nin the MetaMask UI.\n\n- `type` - The type of dialog. Not providing a type will create a fully\n[custom dialog](https://docs.metamask.io/snaps/features/custom-ui/dialogs/#display-a-custom-dialog).\nPossible values are:\n  - `alert` - An alert that can only be acknowledged.\n  - `confirmation` - A confirmation that can be accepted or rejected.\n  - `prompt` - A prompt where the user can enter a text response.\n\n- One of:\n  - `content` - The content of the alert, as a\n[custom UI](https://docs.metamask.io/snaps/features/custom-ui/) component.\n  - `id` - The ID of an\n[interactive interface](https://docs.metamask.io/snaps/reference/snaps-api/snap_createinterface).\n- `placeholder` - An optional placeholder text to display in the dialog. Only\napplicable for the `prompt` dialog.","parameters":{"kind":"union","type":"{ content: JSXElement } | { id: string } | { type: \"alert\"; content: JSXElement } | { type: \"alert\"; id: string } | { type: \"confirmation\"; content: JSXElement } | { type: \"confirmation\"; id: string } | { type: \"prompt\"; content: JSXElement; placeholder?: string | null } | { type: \"prompt\"; id: string; placeholder?: string | null }","description":"An object containing the contents of the dialog.","commonProperties":[],"options":[{"kind":"union","type":"{ type: \"alert\"; content: JSXElement } | { type: \"alert\"; id: string }","description":"An alert dialog.","commonProperties":[{"kind":"primitive","type":"\"alert\"","description":"The literal string \"alert\" to indicate that this is an alert dialog.","name":"type","required":true}],"options":[{"kind":"object","type":"{ type: \"alert\"; content: JSXElement }","description":null,"required":true,"properties":[{"kind":"primitive","type":"JSXElement","description":"The content to display in the alert dialog.","name":"content","required":true}]},{"kind":"object","type":"{ type: \"alert\"; id: string }","description":null,"required":true,"properties":[{"kind":"primitive","type":"string","description":"The Snap interface ID, which can be used to display a previously\ncreated interface. See [`snap_createInterface`](https://docs.metamask.io/snaps/reference/snaps-api/snap_createinterface).","name":"id","required":true}]}]},{"kind":"union","type":"{ type: \"confirmation\"; content: JSXElement } | { type: \"confirmation\"; id: string }","description":"A confirmation dialog.","commonProperties":[{"kind":"primitive","type":"\"confirmation\"","description":"The literal string \"confirmation\" to indicate that this is a\nconfirmation dialog.","name":"type","required":true}],"options":[{"kind":"object","type":"{ type: \"confirmation\"; content: JSXElement }","description":null,"required":true,"properties":[{"kind":"primitive","type":"JSXElement","description":"The content to display in the confirmation dialog.","name":"content","required":true}]},{"kind":"object","type":"{ type: \"confirmation\"; id: string }","description":null,"required":true,"properties":[{"kind":"primitive","type":"string","description":"The Snap interface ID, which can be used to display a previously\ncreated interface. See [`snap_createInterface`](https://docs.metamask.io/snaps/reference/snaps-api/snap_createinterface).","name":"id","required":true}]}]},{"kind":"union","type":"{ type: \"prompt\"; content: JSXElement; placeholder?: string | null } | { type: \"prompt\"; id: string; placeholder?: string | null }","description":"A prompt dialog.","commonProperties":[{"kind":"primitive","type":"\"prompt\"","description":"The literal string \"prompt\" to indicate that this is a prompt dialog.","name":"type","required":true},{"kind":"primitive","type":"string","description":"An optional placeholder text to display in the text input.","name":"placeholder","required":false}],"options":[{"kind":"object","type":"{ type: \"prompt\"; content: JSXElement; placeholder?: string | null }","description":null,"required":true,"properties":[{"kind":"primitive","type":"JSXElement","description":"The content to display in the prompt dialog.","name":"content","required":true}]},{"kind":"object","type":"{ type: \"prompt\"; id: string; placeholder?: string | null }","description":null,"required":true,"properties":[{"kind":"primitive","type":"string","description":"The Snap interface ID, which can be used to display a previously\ncreated interface. See [`snap_createInterface`](https://docs.metamask.io/snaps/reference/snaps-api/snap_createinterface).","name":"id","required":true}]}]},{"kind":"union","type":"{ content: JSXElement } | { id: string }","description":null,"commonProperties":[],"options":[{"kind":"object","type":"{ id: string }","description":null,"required":true,"properties":[{"kind":"primitive","type":"string","description":null,"name":"id","required":true}]},{"kind":"object","type":"{ content: JSXElement }","description":null,"required":true,"properties":[{"kind":"primitive","type":"JSXElement","description":null,"name":"content","required":true}]}]}]},"result":{"kind":"primitive","type":"JSON","description":"- If the dialog is an `alert`, the result is `null`.\n- If the dialog is a `confirmation`, the result is a boolean indicating\nwhether the user confirmed the dialog.\n- If the dialog is a `prompt`, the result is the value entered by\nthe user."},"examples":[{"examples":[{"language":"ts","content":"import { Box, Heading, Text } from '@metamask/snaps-sdk/jsx'\n\nconst walletAddress = await snap.request({\n  method: 'snap_dialog',\n  params: {\n    type: 'prompt',\n    content: (\n      <Box>\n        <Heading>What is the wallet address?</Heading>\n        <Text>Please enter the wallet address to be monitored.</Text>\n      </Box>\n    ),\n    placeholder: '0x123...',\n  },\n})\n\n// `walletAddress` will be a string containing the address entered by the\n// user.\n"}]}],"subjectTypes":["snap"],"restricted":true}}  />
