This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/web/user-interface/inline-text-selection-toolbar/customize-existing-tools.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Customizing text selection toolbar in JavaScript PDF viewer | Nutrient

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:

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