You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/extend/develop/using-host-dialog.md
+78-50Lines changed: 78 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,29 +1,50 @@
1
1
---
2
2
ms.subservice: azure-devops-ecosystem
3
-
title: Modal Dialog | Extensions for Azure DevOps
4
-
description: Use the modal dialog provided by the host for Azure DevOps.
3
+
title: Create modal dialogs in Azure DevOps extensions
4
+
description: Learn how to implement modal dialogs using HostDialogService in Azure DevOps extensions with the azure-devops-extension-sdk package. Build interactive dialogs with custom content, validation, and user interactions.
5
5
ms.assetid: 59748E0E-2D5E-FF79-ED0E-4B76037A8010
6
-
ms.topic: conceptual
6
+
ms.topic: how-to
7
+
ai-usage: ai-assisted
7
8
monikerRange: '<= azure-devops'
8
9
ms.author: chcomley
9
10
author: chcomley
10
-
ms.date: 09/19/2019
11
+
ms.date: 07/02/2025
12
+
# customer-intent: As an Azure DevOps extension developer, I want to create modal dialogs that block user interaction with the entire page so I can collect user input, display forms, and provide focused user experiences in my extensions.
The HostDialogService enables you to present a modal dialog to the user and prevent interaction with all parts of web access until the dialog is dismissed.
19
+
Modal dialogs provide a powerful way to create focused user experiences in Azure DevOps extensions. The HostDialogService lets you present a modal dialog that blocks user interaction with the entire Azure DevOps interface until the dialog gets dismissed. This action ensures that users complete important tasks or provide required information.
- Display confirmation messages for critical actions
24
+
- Show detailed information that requires user attention
25
+
- Guide users through multi-step processes
20
26
21
-
<divclass="alert alert-info">
22
-
In contrast to the standard dialog control, a modal dialog presented via the HostDialogService prevents interaction by the user on the entire page, not just within the extension.
23
-
</div>
27
+
> [!IMPORTANT]
28
+
> When you create modal dialogs with `HostDialogService`, they block interaction with the entire Azure DevOps page, not just your extension. This approach provides a true modal experience but you should use it thoughtfully to avoid disrupting the user workflow.
24
29
30
+
## Prerequisites
25
31
26
-
### Dialog contents
32
+
Before you can create modal dialogs in your Azure DevOps extension, ensure you have the following:
33
+
34
+
| Category | Requirement | Details |
35
+
|----------|-------------|---------|
36
+
|**Extension setup**| Working extension project | A valid `vss-extension.json` manifest file |
37
+
|| Marketplace registration | Extension registered with Visual Studio Marketplace for testing and deployment |
38
+
|| Development knowledge | Understanding of [Azure DevOps extension development basics](../get-started/node.md)|
39
+
|**Development environment**| Node.js and npm | Node.js version 14 or later with npm installed |
40
+
|| Code editor | Visual Studio Code or other IDE recommended |
41
+
|| Azure DevOps access | Access to an Azure DevOps organization for testing |
|| Extension API | Install: `npm install azure-devops-extension-api`|
44
+
|**Extension permissions**| Manifest scopes | Include appropriate scopes in `vss-extension.json`, for example: `"vso.work"`, `"vso.project"`|
45
+
|**SDK imports**| Required modules | Import SDK and services: `import * as SDK from "azure-devops-extension-sdk"` and `import { CommonServiceIds, IHostDialogService } from "azure-devops-extension-api"`|
46
+
47
+
## Dialog contents
27
48
28
49
To start, declare a contribution of type `ms.vss-web.control` in your extension manifest. This contribution represents the content displayed within the dialog.
29
50
@@ -45,7 +66,7 @@ The `uri` property references a page that is rendered within the content area of
To show the dialog (for example, when a user selects an action on a toolbar or menu), call the `openDialog` function on an instance of the HostDialogService, passing the fully-qualified identifier of the dialog content, for example `my-publisher.my-extension.registration-form` and any dialog options:
143
+
To show the dialog (for example, when a user selects an action on a toolbar or menu), call the `openDialog` function on an instance of the HostDialogService, passing the fullyqualified identifier of the dialog content, for example `my-publisher.my-extension.registration-form` and any dialog options:
@@ -136,48 +161,51 @@ To show the dialog (for example, when a user selects an action on a toolbar or m
136
161
});
137
162
```
138
163
139
-
### Showing the dialog (advanced)
164
+
##Advanced dialog features
140
165
141
166
A function can be called when the OK button is selected. This function is specified by `getDialogResult` in the options you provide when showing the dialog.
142
167
143
168
If a call to `getDialogResult` returns a non-null value, this value is then passed to the function specified by `okCallback` (also in the options) and the dialog is closed.
144
169
145
-
In this example, the `attachFormChanged` callback gets called when inputs on the form change. Based on the whether the form is valid or not, the OK button is enabled or disabled.
170
+
In this example, the `attachFormChanged` callback gets called when inputs on the form change. Based on whether the form is valid or not, the OK button is enabled or disabled.
0 commit comments