snap_updateInterface
Description
Update an interactive interface. For use in interactive UI.
Parameters
object
requiredAn object containing the parameters for the snap_updateInterface method.
id
stringThe ID of the interface to update.
ui
JSXElementThe new custom UI content to display in the interface.
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
null
This method does not return any data, so the result is always null.
Example
import { Box, Heading, Text } from "@metamask/snaps-sdk/jsx";
// First, create an interface and get its ID.
const id = await snap.request({
method: "snap_createInterface",
params: {
ui: <Box>...</Box>,
},
});
// Later, update the interface with new content using the ID.
snap.request({
method: "snap_updateInterface",
params: {
id: "interface-id",
ui: (
<Box>
<Heading>Updated Interface</Heading>
<Text>This interface has been updated.</Text>
</Box>
),
},
});