Examples › Action dividers

An item missing both its onClick handler and items property will be rendered as a divider, like so:

const { showContextMenu } = useContextMenu();

const [flipVertical, setFlipVertical] = useState(false);
const [flipHorizontal, setFlipHorizontal] = useState(false);
// ...
return (
  <Picture
    image={image}
    flipVertical={flipVertical}
    flipHorizontal={flipHorizontal}
    onContextMenu={showContextMenu([
      {
        key: 'copy',
        icon: <IconCopy size={16} />,
        onClick: () => copyImageToClipboard(src),
      },
      {
        key: 'download',
        icon: <IconDownload size={16} />,
        onClick: () => downloadImage(src),
      },
      // 👇 render a divider
      //    (the key can be anything, it's just used to identify the item)
      { key: 'divider' },
      {
        key: 'flipVertical',
        icon: <IconFlipVertical size={16} />,
        onClick: () => setFlipVertical((v) => !v),
      },
      {
        key: 'flipHorizontal',
        icon: <IconFlipHorizontal size={16} />,
        onClick: () => setFlipHorizontal((v) => !v),
      },
    ])}
  />
);

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

Picture by Nathalie Jolie | Mantine ContextMenu

Picture by Nathalie Jolie

Head over to the next example to discover other features.