Describes the properties of a Tool Item.
Tool items are standalone tools that can be used in different part of PSPDFKit's UI such as annotation tooltips.
Members
Members
Useful to set a custom CSS class name on the item.
Type:
- string
Whether the item is disabled or not.
Type:
- boolean
Icon for the item.
The icon should either be an URL, a base64 encoded image or the HTML for an inline SVG.
Type:
- string
Unique identifier for the item.
This is useful to identify items whose type
is custom
.
Type:
- string
Example
// In your JavaScript
const item = { type: 'custom', id: 'my-button', ... }
Optionally custom
tool items can define a DOM node.
PSPDFKit renders this node instead of a standard tool button.
In this case the tool item is rendered inside of a container
which gets the title
and className
attributes set.
The icon
property is ignored.
The selected
and disabled
are used just to toggle the
PSPDFKit-Tool-Node-active and PSPDFKit-Tool-Node-disabled
class names but making the node effectively selected or disabled is up to
the implementation of the item.
The onPress
event is registered and fires any time the item is either clicked
or selected with keyboard (if part of a dropdownGroup
).
Type:
- Node
Callback to invoke when the item is clicked or tapped (on touch devices). It gets the event
as
first argument, the id
of the tool item as the second.
Type:
- function
Whether a custom item is selected or not.
Type:
- boolean
Title for the tool items.
It is shown on hover or when the item doesn't have an icon.
Type:
- string
required
The type of a tool item.
At the moment the only supported type is custom
.
Type:
- string
Example
// In your JavaScript
const item = { type: 'custom', ... }