# Regarding customize popup in react using contextPad

**URL:** <https://forum.bpmn.io/t/regarding-customize-popup-in-react-using-contextpad/9474>\
**Category:** Modeler\
**Created:** [July 11, 2023, 5:38am UTC](https://forum.bpmn.io/t/regarding-customize-popup-in-react-using-contextpad/9474 "2023-07-11T05:38:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhay\_Bhagat](https://forum.bpmn.io/user_avatar/forum.bpmn.io/abhay_bhagat/32/4609_2.png) [@Abhay\_Bhagat](https://forum.bpmn.io/u/Abhay_Bhagat)\
**Post date:** [July 11, 2023, 5:38am UTC](https://forum.bpmn.io/t/regarding-customize-popup-in-react-using-contextpad/9474/1 "2023-07-11T05:38:38Z")

</div>

I am using contextPad to customize the bpmn js popup in react `import React, { useRef, useEffect, useState } from ‘react’;  
import BpmnModeler from ‘bpmn-js/lib/Modeler’;  
import ‘bpmn-js/dist/assets/bpmn-font/css/bpmn.css’;  
import ‘bpmn-js/dist/assets/diagram-js.css’;

const BpmnEditor = () =\> {  
const [bpmnXml, setBpmnXml] = useState(null);  
const containerRef = useRef(null);  
const modelerRef = useRef(null);

```
const createDiagram = async () => {
    try {
        const newDiagram = await modelerRef.current.createDiagram();
        if (newDiagram) {
            console.log('BPMN diagram created successfully!');
        } else {
            console.error('Error creating BPMN diagram.');
        }
    } catch (err) {
        console.error('Error creating BPMN diagram:', err);
    }
};

const openDiagram = (xml) => {
    modelerRef.current.importXML(xml, (err, warnings) => {
        if (err) {
            console.error('Error rendering BPMN diagram:', err);
        } else {
            console.log('BPMN diagram rendered successfully!');
            if (warnings && warnings.length) {
                console.warn('Warnings:', warnings);
            }
        }
    });
};

const registerCustomMenu = () => {
    const contextPad = modelerRef.current.get('contextPad');

    contextPad.registerProvider('bpmn.Task', {
        getEntries: function (element) {
            const entries = [];

            entries.push({
                id: 'partCreation',
                label: 'Part Creation',
                action: function (event, element) {
                    console.log('Part Creation triggered');
                },
                priority: 1
            });
            entries.push({
                id: 'documentCreation',
                label: 'Document Creation',
                action: function (event, element) {
                    console.log('Document Creation triggered');
                },
                priority: 2
            });

            return entries;
        },
    });
};

useEffect(() => {
    modelerRef.current = new BpmnModeler({
        container: containerRef.current,
    });

    if (bpmnXml) {
        openDiagram(bpmnXml);
    } else {
        createDiagram();
    }

    registerCustomMenu();

    return () => {
        modelerRef.current.destroy();
    };
}, [bpmnXml]);

return (
    <div>
        <div ref={containerRef} style={{ height: '800px' }} />
    </div>
);

```

};

export default BpmnEditor;`  
this is my code but it gives Uncaught Error: priority must be a number

on EventBus.js:135

registerProvider ContextPad.js:135

registerCustomMenu CustomTypeBPMNEditor.js:1705

BpmnEditor CustomTypeBPMNEditor.js:1742

React 8

workLoop scheduler.development.js:266

flushWork scheduler.development.js:239

performWorkUntilDeadline scheduler.development.js:533

js scheduler.development.js:571

js scheduler.development.js:633

factory react refresh:6

Webpack 24

[EventBus.js:135](http://localhost:3000/home/abhaykumar/Desktop/ABCD/flowEditor/flow-editor1/flow-editor/node_modules/bpmn-js/node_modules/diagram-js/lib/core/EventBus.js)

on EventBus.js:135

registerProvider ContextPad.js:135

registerCustomMenu CustomTypeBPMNEditor.js:1705

BpmnEditor CustomTypeBPMNEditor.js:1742

React 8

workLoop scheduler.development.js:266

flushWork scheduler.development.js:239

performWorkUntilDeadline scheduler.development.js:533

(Async: EventHandlerNonNull)  
js scheduler.development.js:571

js scheduler.development.js:633

factory react refresh:6

Webpack 24

Uncaught Error: priority must be a number

on EventBus.js:135

registerProvider ContextPad.js:135

registerCustomMenu CustomTypeBPMNEditor.js:1705

BpmnEditor CustomTypeBPMNEditor.js:1742

React 7

workLoop scheduler.development.js:266

flushWork scheduler.development.js:239

performWorkUntilDeadline scheduler.development.js:533

js scheduler.development.js:571

js scheduler.development.js:633

factory react refresh:6

Webpack 24  
this error as you see include priority number inside the code. can anybody please help me with this

---

<div class="post-metadata">

**Author:** ![barmac](https://forum.bpmn.io/user_avatar/forum.bpmn.io/barmac/32/974_2.png) [@barmac](https://forum.bpmn.io/u/barmac)\
**Post date:** [July 11, 2023, 7:57am UTC](https://forum.bpmn.io/t/regarding-customize-popup-in-react-using-contextpad/9474/2 "2023-07-11T07:57:23Z")

</div>

Please share a running / prototypical example that clearly shows what you’re trying to achieve, what is working and what is not. Currently, I don’t see the context pad code in what you shared.

Use our existing [starter projects](https://github.com/bpmn-io/bpmn-js-examples/tree/master/starter) to quickly hack it or share your existing, partial solution on GitHub or via a [CodeSandbox](https://codesandbox.io/s/bpmn-js-starter-m3kex?file=/src/index.js). Provide the necessary pointers that allow us to quickly understand where you got stuck.

This way we may be able to help you in a constructive manner.

Thanks ❤

---

<div class="post-metadata">

**Author:** ![Abhay\_Bhagat](https://forum.bpmn.io/user_avatar/forum.bpmn.io/abhay_bhagat/32/4609_2.png) [@Abhay\_Bhagat](https://forum.bpmn.io/u/Abhay_Bhagat)\
**Post date:** [July 11, 2023, 8:12am UTC](https://forum.bpmn.io/t/regarding-customize-popup-in-react-using-contextpad/9474/3 "2023-07-11T08:12:58Z")

</div>

okay !! sorry for messy question. this is code [bpmnCode](https://codesandbox.io/s/snowy-fire-lml32z?file=/src/BPMN.js)

priority must be a number error

---

<div class="post-metadata">

**Author:** ![barmac](https://forum.bpmn.io/user_avatar/forum.bpmn.io/barmac/32/974_2.png) [@barmac](https://forum.bpmn.io/u/barmac)\
**Post date:** [July 11, 2023, 8:35am UTC](https://forum.bpmn.io/t/regarding-customize-popup-in-react-using-contextpad/9474/4 "2023-07-11T08:35:55Z")

</div>

`ContextPad#registerProvider` does not accept a string argument, cf. [https://github.com/bpmn-io/diagram-js/blob/develop/lib/features/context-pad/ContextPad.js#L159](https://github.com/bpmn-io/diagram-js/blob/develop/lib/features/context-pad/ContextPad.js#L159)

Try out this fix:

```diff
- contextPad.registerProvider("bpmn.Task", {
+ contextPad.registerProvider({
      getEntries: function (element) {

```

---

<div class="post-metadata">

**Author:** ![Abhay\_Bhagat](https://forum.bpmn.io/user_avatar/forum.bpmn.io/abhay_bhagat/32/4609_2.png) [@Abhay\_Bhagat](https://forum.bpmn.io/u/Abhay_Bhagat)\
**Post date:** [July 11, 2023, 8:47am UTC](https://forum.bpmn.io/t/regarding-customize-popup-in-react-using-contextpad/9474/5 "2023-07-11T08:47:34Z")

</div>

![Screenshot from 2023-07-11 14-13-46](https://forum.bpmn.io/uploads/default/original/2X/4/44d4834ad2af3ad4a8f03410797b5cf94bc36751.png)  
well that error is gone but my main task is to customize this above popup. it didn’t achieve by my given code. what should i do ?

---

<div class="post-metadata">

**Author:** ![philippfromme](https://forum.bpmn.io/user_avatar/forum.bpmn.io/philippfromme/32/2803_2.png) [@philippfromme](https://forum.bpmn.io/u/philippfromme)\
**Post date:** [July 17, 2023, 2:11pm UTC](https://forum.bpmn.io/t/regarding-customize-popup-in-react-using-contextpad/9474/6 "2023-07-17T14:11:02Z")

</div>

See my answer in your other topic: [Customise the popup in reactJs](https://forum.bpmn.io/t/customise-the-popup-in-reactjs/9477)

---

<div class="post-metadata">

**Author:** ![barmac](https://forum.bpmn.io/user_avatar/forum.bpmn.io/barmac/32/974_2.png) [@barmac](https://forum.bpmn.io/u/barmac)\
**Post date:** [July 9, 2025, 10:12am UTC](https://forum.bpmn.io/t/regarding-customize-popup-in-react-using-contextpad/9474/7 "2025-07-09T10:12:04Z")

</div>

Closed on July 9, 2025, 10:12am UTC

Closing old topics.
