Nutrient Web SDK
    Preparing search index...

    Interface DocumentEditorToolbarItem

    Describes the properties of a Document Editor Toolbar Item.

    Check out our guides for more examples.

    export interface DocumentEditorToolbarItem extends DocumentEditorBuiltinToolbarItem, DocumentEditorCustomToolbarItem { type: BuiltInDocumentEditorToolbarItemType | 'custom' }

    interface DocumentEditorToolbarItem {
        className?: string;
        disabled?: boolean;
        icon?: string;
        id?: string;
        node?: Node;
        onPress?: (e: Event) => void;
        selected?: boolean;
        title?: string;
        type:
            | | "zoom-out"
            | "zoom-in"
            | "spacer"
            | "add"
            | "remove"
            | "duplicate"
            | "rotate-left"
            | "rotate-right"
            | "move"
            | "move-left"
            | "move-right"
            | "import-document"
            | "extract-pages"
            | "undo"
            | "redo"
            | "select-all"
            | "select-none"
            | "custom";
    }

    Hierarchy

    • DocumentEditorBuiltinToolbarItem
    • DocumentEditorCustomToolbarItem
      • DocumentEditorToolbarItem
    Index

    Properties

    className?: string

    Useful to set a custom CSS class name on the item.

    For default document editor toolbar items the className is appended to the default item ones.

    disabled?: boolean

    Whether the item is disabled or not.

    The property can be used to force a default item to be disabled by setting it to true.

    icon?: string

    Icon for the item.

    The icon should either be an URL, a base64 encoded image or the HTML for an inline SVG. This property can override the default items' ones.

    id?: string

    Unique identifier for the item.

    This is useful to identify items whose type is custom.

    // In your JavaScript
    const documentEditorToolbarItems = NutrientViewer.defaultDocumentEditorToolbarItems
    documentEditorToolbarItems.push({ type: 'custom', id: 'my-button', ... })
    NutrientViewer.load({
    ...otherOptions,
    documentEditorToolbarItems
    });

    Note: It is ***not*** possible to override this option for built-in document editor toolbar items.
    node?: Node

    Optionally custom tool items can define a DOM node. NutrientViewer 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).

    onPress?: (e: Event) => void
    selected?: boolean

    Whether a custom item is selected or not.

    The selected status of default items cannot be altered.

    Note: It is not possible to override this option for built-in document editor toolbar items.

    title?: string

    Title for the tool items.

    It is shown on hover or when the item doesn't have an icon.

    type:
        | | "zoom-out"
        | "zoom-in"
        | "spacer"
        | "add"
        | "remove"
        | "duplicate"
        | "rotate-left"
        | "rotate-right"
        | "move"
        | "move-left"
        | "move-right"
        | "import-document"
        | "extract-pages"
        | "undo"
        | "redo"
        | "select-all"
        | "select-none"
        | "custom"