Customizing Existing Tools in Our Inline Text Selection Toolbar

Customize the following properties of built-in items:

  • className

  • icon

  • id

  • onPress

  • title

The example below adds a custom onPress handler to the first item of the inline text selection toolbar:

PSPDFKit.load({
  // ...otherOptions
  inlineTextSelectionToolbarItems: ({ defaultItems }) => {
    defaultItems[0].onPress = () => alert("Custom onPress handler!");
    return defaultItems;
  }
});