How to hide save/close buttons when displaying Custom UI in create dialog

I have a Custom UI for a Jira Custom Field. This works nicely when a user clicks on the field to edit the field value. I get a nice modal pop-up where the user can select the value and save it.

But if I want this same custom field with Custom UI to appear in the Jira issue create dialog, it looks totally out of place to have a the save/close buttons at the bottom of my Custom UI.

The ‘view’ aspect of the custom field module uses standard UI Kit components. But the ‘edit’ aspect uses the Custom UI.

Is there a better approach? Is there a way to tell when the Custom UI is being shown in the Create modal and hide these buttons?

I may have found the answer.

I’ll try calling

const { extensionContext: { renderContext } = useProductContext();

And seeing if I can determine if I’m in the Create dialog and whether to show the save/close buttons.

I eventually got it working. I had slightly different code since I needed the renderContext in Custom UI and not in a UI Kit component. So it looked more like…

//renderContext possible values: issue-create, issue-view
const { extension: {  renderContext } } = await view.getContext();

Then depending on the renderContext value, I would either show or not show the save button. If it was ‘issue-create’ renderContext, then I needed to auto-save the input since we can’t rely on the user pressing the save button.

view.submit(values);

1 Like