Skip to main content
  • Snap

snap_createInterface

Description

Create the interactive interface for use in the interactive UI.

Parameters

object
required

An object containing the parameters for the snap_createInterface method.

ui

JSXElement
required

The custom UI to create.

context

Record<string, JSON>

Optional context for the interface, which can be used to provide additional information about the interface to the Snap, without being part of the UI itself.

Returns

string

The interface's ID to be used in subsequent calls to custom UI methods such as snap_updateInterface, or to display the interface using one of the interface display methods such as snap_dialog.

Example

import { Box, Heading, Text } from "@metamask/snaps-sdk/jsx";

const interfaceId = snap.request({
method: "snap_createInterface",
params: {
ui: (
<Box>
<Heading>Example Interface</Heading>
<Text>
This is an example interface created by "snap_createInterface".
</Text>
</Box>
),
},
});
On this page