Examples › Action icons

You can provide action icons to the context menu items by setting the icon and iconRight properties, like so:

const { showContextMenu } = useContextMenu();
// ...
return (
  <Picture
    image={image}
    onContextMenu={showContextMenu([
      {
        key: 'copy',
        icon: <IconCopy size={16} />,
        onClick: () => copyImageToClipboard(src),
      },
      {
        key: 'download',
        iconRight: <IconDownload size={16} />,
        onClick: () => downloadImage(src),
      },
      {
        key: 'delete',
        icon: <IconTrash size={16} />,
        iconRight: <IconExclamationCircle size={16} />,
        onClick: () => handleDelete,
      },
    ])}
  />
);

Right-click on the image to trigger the context menu:

Picture by Roberto Huczek | Mantine ContextMenu

Picture by Roberto Huczek

Head over to the next example to discover other features.