1# @ohos.promptAction (Prompt) 2 3The **PromptAction** module provides APIs for creating and showing toasts, dialog boxes, and action menus. 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8> 9> This module cannot be used in the file declaration of the [UIAbility](../apis-ability-kit/js-apis-app-ability-uiAbility.md). In other words, the APIs of this module can be used only after a component instance is created; they cannot be called in the lifecycle of the UIAbility. 10> 11> The functionality of this module depends on UI context. This means that the APIs of this module cannot be used where the UI context is unclear. For details, see [UIContext](js-apis-arkui-UIContext.md#uicontext). Except for UI-less scenarios<!--Del--> such as [ServiceExtension](../../application-models/serviceextensionability.md)<!--DelEnd-->, it is recommended that you use the dialog APIs provided by **UIContext**. 12> 13> Since API version 10, you can use the [getPromptAction](js-apis-arkui-UIContext.md#getpromptaction) API in [UIContext](js-apis-arkui-UIContext.md#uicontext) to obtain the [PromptAction](js-apis-arkui-UIContext.md#promptaction) object associated with the current UI context. 14 15## Modules to Import 16 17```ts 18import { promptAction } from '@kit.ArkUI'; 19``` 20 21## promptAction.showToast 22 23showToast(options: ShowToastOptions): void 24 25Shows a toast. 26 27**Atomic service API**: This API can be used in atomic services since API version 11. 28 29**System capability**: SystemCapability.ArkUI.ArkUI.Full 30 31**Parameters** 32 33| Name | Type | Mandatory | Description | 34| ------- | ------------------------------------- | ---- | ------- | 35| options | [ShowToastOptions](#showtoastoptions) | Yes | Toast options.| 36 37**Error codes** 38 39For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [promptAction Error Codes](errorcode-promptAction.md). 40 41| ID | Error Message| 42| --------- | ------- | 43| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameters types; 3. Parameter verification failed. | 44| 100001 | Internal error. | 45 46**Example** 47 48```ts 49import { promptAction } from '@kit.ArkUI' 50import { BusinessError } from '@kit.BasicServicesKit'; 51 52@Entry 53@Component 54struct toastExample { 55 build() { 56 Column() { 57 Button('Show toast').fontSize(20) 58 .onClick(() => { 59 try { 60 promptAction.showToast({ 61 message: 'Hello World', 62 duration: 2000 63 }); 64 } catch (error) { 65 let message = (error as BusinessError).message 66 let code = (error as BusinessError).code 67 console.error(`showToast args error code is ${code}, message is ${message}`); 68 }; 69 }) 70 }.height('100%').width('100%').justifyContent(FlexAlign.Center) 71 } 72} 73``` 74Below is a toast in API version 11 and earlier versions. 75 76 77 78Below is a toast in API version 12 and later versions. 79 80 81 82## promptAction.showDialog 83 84showDialog(options: ShowDialogOptions): Promise<ShowDialogSuccessResponse> 85 86Shows a dialog box. This API uses a promise to return the result asynchronously. 87 88**Atomic service API**: This API can be used in atomic services since API version 11. 89 90**System capability**: SystemCapability.ArkUI.ArkUI.Full 91 92**Parameters** 93 94| Name | Type | Mandatory | Description | 95| ------- | --------------------------------------- | ---- | ------ | 96| options | [ShowDialogOptions](#showdialogoptions) | Yes | Dialog box options.| 97 98**Return value** 99 100| Type | Description | 101| ---------------------------------------- | -------- | 102| Promise<[ShowDialogSuccessResponse](#showdialogsuccessresponse)> | Promise used to return the dialog box response result.| 103 104**Error codes** 105 106For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [promptAction Error Codes](errorcode-promptAction.md). 107 108| ID | Error Message| 109| --------- | ------- | 110| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameters types; 3. Parameter verification failed. | 111| 100001 | Internal error. | 112 113**Example** 114 115```ts 116import { promptAction } from '@kit.ArkUI' 117 118promptAction.showDialog({ 119 title: 'Title Info', 120 message: 'Message Info', 121 buttons: [ 122 { 123 text: 'button1', 124 color: '#000000' 125 }, 126 { 127 text: 'button2', 128 color: '#000000' 129 } 130 ], 131}) 132 .then(data => { 133 console.info('showDialog success, click button: ' + data.index); 134 }) 135 .catch((err: Error) => { 136 console.info('showDialog error: ' + err); 137 }) 138``` 139 140 141 142## promptAction.showDialog 143 144showDialog(options: ShowDialogOptions, callback: AsyncCallback<ShowDialogSuccessResponse>):void 145 146Shows a dialog box. This API uses an asynchronous callback to return the result. 147 148**Atomic service API**: This API can be used in atomic services since API version 11. 149 150**System capability**: SystemCapability.ArkUI.ArkUI.Full 151 152**Parameters** 153 154| Name | Type | Mandatory | Description | 155| -------- | ---------------------------------------- | ---- | ------------ | 156| options | [ShowDialogOptions](#showdialogoptions) | Yes | Dialog box options.| 157| callback | AsyncCallback<[ShowDialogSuccessResponse](#showdialogsuccessresponse)> | Yes | Callback used to return the dialog box response result. | 158 159**Error codes** 160 161For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [promptAction Error Codes](errorcode-promptAction.md). 162 163| ID | Error Message| 164| --------- | ------- | 165| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameters types; 3. Parameter verification failed. | 166| 100001 | Internal error. | 167 168**Example** 169 170```ts 171import { promptAction } from '@kit.ArkUI'; 172import { BusinessError } from '@kit.BasicServicesKit'; 173 174try { 175 promptAction.showDialog({ 176 title: 'showDialog Title Info', 177 message: 'Message Info', 178 buttons: [ 179 { 180 text: 'button1', 181 color: '#000000' 182 }, 183 { 184 text: 'button2', 185 color: '#000000' 186 } 187 ] 188 }, (err, data) => { 189 if (err) { 190 console.info('showDialog err: ' + err); 191 return; 192 } 193 console.info('showDialog success callback, click button: ' + data.index); 194 }); 195} catch (error) { 196 let message = (error as BusinessError).message 197 let code = (error as BusinessError).code 198 console.error(`showDialog args error code is ${code}, message is ${message}`); 199}; 200``` 201 202 203 204When the **showInSubWindow** attribute is set to **true**, the toast can be displayed outside the window. 205 206```ts 207import { promptAction } from '@kit.ArkUI'; 208import { BusinessError } from '@kit.BasicServicesKit'; 209 210try { 211 promptAction.showDialog({ 212 title: 'showDialog Title Info', 213 message: 'Message Info', 214 isModal: true, 215 showInSubWindow: true, 216 buttons: [ 217 { 218 text: 'button1', 219 color: '#000000' 220 }, 221 { 222 text: 'button2', 223 color: '#000000' 224 } 225 ] 226 }, (err, data) => { 227 if (err) { 228 console.info('showDialog err: ' + err); 229 return; 230 } 231 console.info('showDialog success callback, click button: ' + data.index); 232 }); 233} catch (error) { 234 let message = (error as BusinessError).message 235 let code = (error as BusinessError).code 236 console.error(`showDialog args error code is ${code}, message is ${message}`); 237}; 238``` 239 240 241 242 243 244## promptAction.showActionMenu 245 246showActionMenu(options: ActionMenuOptions, callback: AsyncCallback<ActionMenuSuccessResponse>):void 247 248Shows an action menu. This API uses a callback to return the result asynchronously. 249 250**Atomic service API**: This API can be used in atomic services since API version 11. 251 252**System capability**: SystemCapability.ArkUI.ArkUI.Full 253 254**Parameters** 255 256| Name | Type | Mandatory | Description | 257| -------- | ---------------------------------------- | ---- | --------- | 258| options | [ActionMenuOptions](#actionmenuoptions) | Yes | Action menu options. | 259| callback | AsyncCallback<[ActionMenuSuccessResponse](#actionmenusuccessresponse)> | Yes | Callback used to return the action menu response result.| 260 261**Error codes** 262 263For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [promptAction Error Codes](errorcode-promptAction.md). 264 265| ID | Error Message| 266| --------- | ------- | 267| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameters types; 3. Parameter verification failed. | 268| 100001 | Internal error. | 269 270**Example** 271 272```ts 273import { promptAction } from '@kit.ArkUI'; 274import { BusinessError } from '@kit.BasicServicesKit'; 275 276try { 277 promptAction.showActionMenu({ 278 title: 'Title Info', 279 buttons: [ 280 { 281 text: 'item1', 282 color: '#666666' 283 }, 284 { 285 text: 'item2', 286 color: '#000000' 287 }, 288 ] 289 }, (err, data) => { 290 if (err) { 291 console.info('showActionMenu err: ' + err); 292 return; 293 } 294 console.info('showActionMenu success callback, click button: ' + data.index); 295 }) 296} catch (error) { 297 let message = (error as BusinessError).message 298 let code = (error as BusinessError).code 299 console.error(`showActionMenu args error code is ${code}, message is ${message}`); 300}; 301``` 302 303 304 305## promptAction.showActionMenu 306 307showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse> 308 309Shows an action menu. This API uses a promise to return the result asynchronously. 310 311**Atomic service API**: This API can be used in atomic services since API version 11. 312 313**System capability**: SystemCapability.ArkUI.ArkUI.Full 314 315**Parameters** 316 317| Name | Type | Mandatory | Description | 318| ------- | --------------------------------------- | ---- | ------- | 319| options | [ActionMenuOptions](#actionmenuoptions) | Yes | Action menu options.| 320 321**Return value** 322 323| Type | Description | 324| ---------------------------------------- | ------- | 325| Promise<[ActionMenuSuccessResponse](#actionmenusuccessresponse)> | Promise used to return the action menu response result.| 326 327**Error codes** 328 329For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [promptAction Error Codes](errorcode-promptAction.md). 330 331| ID | Error Message| 332| --------- | ------- | 333| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameters types; 3. Parameter verification failed. | 334| 100001 | Internal error. | 335 336**Example** 337 338```ts 339import { promptAction } from '@kit.ArkUI'; 340 341promptAction.showActionMenu({ 342 title: 'showActionMenu Title Info', 343 buttons: [ 344 { 345 text: 'item1', 346 color: '#666666' 347 }, 348 { 349 text: 'item2', 350 color: '#000000' 351 }, 352 ] 353}) 354 .then(data => { 355 console.info('showActionMenu success, click button: ' + data.index); 356 }) 357 .catch((err: Error) => { 358 console.info('showActionMenu error: ' + err); 359 }) 360``` 361 362 363 364## promptAction.openCustomDialog<sup>11+</sup> 365 366openCustomDialog(options: CustomDialogOptions): Promise<number> 367 368Opens a custom dialog box. 369 370<!--Del-->This API cannot be used in **ServiceExtension**.<!--DelEnd--> 371 372**isModal = true** and **showInSubWindow = true** cannot be used at the same time. 373 374By default, the width of the dialog box in portrait mode is the width of the window where it is located minus the left and right margins (40 vp for 2-in-1 devices and 16 vp for other devices), and the maximum width is 400 vp. 375 376**Atomic service API**: This API can be used in atomic services since API version 12. 377 378**System capability**: SystemCapability.ArkUI.ArkUI.Full 379 380**Parameters** 381 382| Name | Type | Mandatory| Description | 383| ------- | --------------------------------------------- | ---- | ------------------ | 384| options | [CustomDialogOptions](#customdialogoptions11) | Yes | Content of the custom dialog box.| 385 386**Return value** 387 388| Type | Description | 389| --------------------- | ------------------------------------- | 390| Promise<number> | ID of the custom dialog box, which can be used in **closeCustomDialog**.| 391 392**Error codes** 393 394For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [promptAction Error Codes](errorcode-promptAction.md). 395 396| ID| Error Message | 397| -------- | ---------------------------------- | 398| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameters types; 3. Parameter verification failed. | 399| 100001 | Internal error. | 400 401**Example** 402 403```ts 404import { promptAction } from '@kit.ArkUI' 405import { BusinessError } from '@kit.BasicServicesKit' 406 407@Entry 408@Component 409struct Index { 410 private customDialogComponentId: number = 0 411 412 @Builder 413 customDialogComponent() { 414 Column() { 415 Text('Dialog box').fontSize(30) 416 Row({ space: 50 }) { 417 Button("OK").onClick(() => { 418 try { 419 promptAction.closeCustomDialog(this.customDialogComponentId) 420 } catch (error) { 421 let message = (error as BusinessError).message; 422 let code = (error as BusinessError).code; 423 console.error(`closeCustomDialog error code is ${code}, message is ${message}`); 424 } 425 }) 426 Button("Cancel").onClick(() => { 427 try { 428 promptAction.closeCustomDialog(this.customDialogComponentId) 429 } catch (error) { 430 let message = (error as BusinessError).message; 431 let code = (error as BusinessError).code; 432 console.error(`closeCustomDialog error code is ${code}, message is ${message}`); 433 } 434 }) 435 } 436 }.height(200).padding(5).justifyContent(FlexAlign.SpaceBetween) 437 } 438 439 build() { 440 Row() { 441 Column({ space: 20 }) { 442 Text('In-component dialog box') 443 .fontSize(30) 444 .onClick(() => { 445 promptAction.openCustomDialog({ 446 builder: () => { 447 this.customDialogComponent() 448 }, 449 onWillDismiss: (dismissDialogAction: DismissDialogAction) => { 450 console.info("reason" + JSON.stringify(dismissDialogAction.reason)) 451 console.log("dialog onWillDismiss") 452 if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { 453 dismissDialogAction.dismiss() 454 } 455 if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { 456 dismissDialogAction.dismiss() 457 } 458 } 459 }).then((dialogId: number) => { 460 this.customDialogComponentId = dialogId 461 }) 462 .catch((error: BusinessError) => { 463 console.error(`openCustomDialog error code is ${error.code}, message is ${error.message}`) 464 }) 465 }) 466 } 467 .width('100%') 468 } 469 .height('100%') 470 } 471} 472 473``` 474This example demonstrates how to set styles of a dialog box, including the width, height, background color, and shadow. 475```ts 476import { promptAction, LevelMode, ImmersiveMode } from '@kit.ArkUI' 477 478let customDialogId: number = 0 479 480@Builder 481function customDialogBuilder() { 482 Column() { 483 Text('Custom dialog Message').fontSize(10) 484 Row() { 485 Button("OK").onClick(() => { 486 promptAction.closeCustomDialog(customDialogId) 487 }) 488 Blank().width(50) 489 Button("Cancel").onClick(() => { 490 promptAction.closeCustomDialog(customDialogId) 491 }) 492 } 493 } 494} 495 496@Entry 497@Component 498struct Index { 499 @State message: string = 'Hello World' 500 501 @Builder 502 customDialogComponent() { 503 customDialogBuilder() 504 } 505 506 build() { 507 Row() { 508 Column() { 509 Text(this.message).id("test_text") 510 .fontSize(50) 511 .fontWeight(FontWeight.Bold) 512 .onClick(() => { 513 const node: FrameNode | null = this.getUIContext().getFrameNodeById("test_text") || null; 514 promptAction.openCustomDialog({ 515 builder: () => { 516 this.customDialogComponent() 517 }, 518 keyboardAvoidMode: KeyboardAvoidMode.NONE, 519 showInSubWindow: false, 520 offset: { dx: 5, dy: 5 }, 521 backgroundColor: 0xd9ffffff, 522 cornerRadius: 20, 523 width: '80%', 524 height: 200, 525 borderWidth: 1, 526 borderStyle: BorderStyle.Dashed, // borderStyle must be used with borderWidth in pairs. 527 borderColor: Color.Blue, // borderColor must be used with borderWidth in pairs. 528 shadow: ({ 529 radius: 20, 530 color: Color.Grey, 531 offsetX: 50, 532 offsetY: 0 533 }), 534 levelMode: LevelMode.EMBEDDED, 535 levelUniqueId: node?.getUniqueId(), 536 immersiveMode: ImmersiveMode.DEFAULT, 537 }).then((dialogId: number) => { 538 customDialogId = dialogId 539 }) 540 }) 541 } 542 .width('100%') 543 } 544 .height('100%') 545 } 546} 547``` 548 549 550This example shows how to implement a dialog box on a page. 551```ts 552// Index.ets 553import { promptAction, LevelMode, ImmersiveMode, router } from '@kit.ArkUI' 554 555let customDialogId: number = 0 556 557@Builder 558function customDialogBuilder() { 559 Column() { 560 Text('Custom dialog Message').fontSize(10).height(100) 561 Row() { 562 Button("Next").onClick(() => { 563 router.pushUrl({url: 'pages/Next'}) 564 }) 565 Blank().width(50) 566 Button("Close").onClick(() => { 567 promptAction.closeCustomDialog(customDialogId) 568 }) 569 } 570 }.padding(20) 571} 572 573@Entry 574@Component 575struct Index { 576 @State message: string = 'Hello World' 577 578 @Builder 579 customDialogComponent() { 580 customDialogBuilder() 581 } 582 583 build() { 584 Row() { 585 Column() { 586 Text(this.message).id("test_text") 587 .fontSize(50) 588 .fontWeight(FontWeight.Bold) 589 .onClick(() => { 590 const node: FrameNode | null = this.getUIContext().getFrameNodeById("test_text") || null; 591 promptAction.openCustomDialog({ 592 builder: () => { 593 this.customDialogComponent() 594 }, 595 levelMode: LevelMode.EMBEDDED, 596 levelUniqueId: node?.getUniqueId(), 597 immersiveMode: ImmersiveMode.DEFAULT, 598 }).then((dialogId: number) => { 599 customDialogId = dialogId 600 }) 601 }) 602 } 603 .width('100%') 604 } 605 .height('100%') 606 } 607} 608``` 609```ts 610// Next.ets 611import { router } from '@kit.ArkUI' 612 613@Entry 614@Component 615struct Next { 616 @State message: string = 'Back' 617 618 build() { 619 Row() { 620 Column() { 621 Button(this.message) 622 .fontSize(50) 623 .fontWeight(FontWeight.Bold) 624 .onClick(() => { 625 router.back() 626 }) 627 } 628 .width('100%') 629 } 630 .height('100%') 631 } 632} 633``` 634 635 636## promptAction.closeCustomDialog<sup>11+</sup> 637 638closeCustomDialog(dialogId: number): void 639 640Closes the specified custom dialog box. 641 642**Atomic service API**: This API can be used in atomic services since API version 12. 643 644**System capability**: SystemCapability.ArkUI.ArkUI.Full 645 646**Parameters** 647 648| Name | Type | Mandatory| Description | 649| -------- | ------ | ---- | -------------------------------- | 650| dialogId | number | Yes | ID of the custom dialog box to close. It is returned from **openCustomDialog**.| 651 652**Error codes** 653 654For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [promptAction Error Codes](errorcode-promptAction.md). 655 656| ID| Error Message | 657| -------- | ---------------------------------- | 658| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameters types; 3. Parameter verification failed. | 659| 100001 | Internal error. | 660 661**Example** 662 663See the example of [promptAction.openCustomDialog](#promptactionopencustomdialog11). 664 665## ShowToastOptions 666 667Describes the options for showing the toast. 668 669**System capability**: SystemCapability.ArkUI.ArkUI.Full 670 671| Name | Type | Mandatory| Description | 672| ----------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 673| message | string \| [Resource](arkui-ts/ts-types.md#resource) | Yes | Text to display.<br>**NOTE**<br>The default font is **'Harmony Sans'**. Other fonts are not supported.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 674| duration | number | No | Duration that the toast will remain on the screen. The default value is 1500 ms. The value range is 1500 ms to 10000 ms. If a value less than 1500 ms is set, the default value is used. If the value greater than 10000 ms is set, the upper limit 10000 ms is used.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 675| bottom | string \| number | No | Distance from the bottom of the toast to the navigation bar. In **ToastShowMode.TOP_MOST** mode, if the soft keyboard is raised and the **bottom** value is too small, the toast will automatically avoid being blocked by the soft keyboard by moving up 80 vp above it. In **ToastShowMode.DEFAULT** mode, the toast will move up by the height of the soft keyboard.<br>Default value: **80vp**<br>**NOTE**<br>When there is no navigation bar at the bottom, **bottom** sets the distance from the bottom of the toast to the bottom of the window.<br>If the **alignment** property is set, **bottom** will not take effect.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 676| showMode<sup>11+</sup> | [ToastShowMode](#toastshowmode11) | No | Whether to show the toast above the application.<br>Default value: **ToastShowMode.DEFAULT**, which means to show the toast in the application.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 677| alignment<sup>12+</sup> | [Alignment](arkui-ts/ts-appendix-enums.md#alignment) | No | Alignment mode.<br>Default value: **undefined**, indicating bottom start<br>**Atomic service API**: This API can be used in atomic services since API version 12. | 678| offset<sup>12+</sup> | [Offset](arkui-ts/ts-types.md#offset) | No | Offset in the specified alignment mode.<br>Default value: **{ dx: 0, dy: 0 }**, indicating no offset<br>**NOTE**<br>Only values in the px unit are accepted. To use the vp unit, convert them to px first.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 679| backgroundColor<sup>12+</sup> | [ResourceColor](arkui-ts/ts-types.md#resourcecolor) | No | Background color of the toast.<br>Default value: **Color.Transparent**<br>**NOTE**<br>When **backgroundColor** is set to a non-transparent color, **backgroundBlurStyle** must be set to **BlurStyle.NONE**; otherwise, the color display may not meet the expected effect.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 680| textColor<sup>12+</sup> | [ResourceColor](arkui-ts/ts-types.md#resourcecolor) | No | Font color of the toast.<br>Default value: **Color.Black**<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 681| backgroundBlurStyle<sup>12+</sup> | [BlurStyle](arkui-ts/ts-universal-attributes-background.md#blurstyle9) | No | Background blur style of the toast.<br>Default value: **BlurStyle.COMPONENT_ULTRA_THICK**<br>**NOTE**<br>Setting this parameter to **BlurStyle.NONE** disables the background blur. When **backgroundBlurStyle** is set to a value other than **NONE**, do not set **backgroundColor**. If you do, the color display may not produce the expected visual effect.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 682| shadow<sup>12+</sup> | [ShadowOptions](arkui-ts/ts-universal-attributes-image-effect.md#shadowoptions) \| [ShadowStyle](arkui-ts/ts-universal-attributes-image-effect.md#shadowstyle10) | No | Background shadow of the toast.<br>Default value: **ShadowStyle.OUTER_DEFAULT_MD**<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 683| enableHoverMode<sup>14+</sup> | boolean | No | Whether to enable the hover state.<br>Default value: **False**, meaning not to enable the hover state.<br>**Atomic service API**: This API can be used in atomic services since API version 14.| 684| hoverModeArea<sup>14+</sup> | [HoverModeAreaType](arkui-ts/ts-appendix-enums.md#hovermodeareatype14) | No | Display area of the toast in the hover state.<br>Default value: **HoverModeAreaType.BOTTOM_SCREEN**, indicating that the toast is displayed in the lower half screen<br>**Atomic service API**: This API can be used in atomic services since API version 14. | 685 686## ToastShowMode<sup>11+</sup> 687 688Describes the mode in which the toast is shown. 689 690**Atomic service API**: This API can be used in atomic services since API version 12. 691 692**System capability**: SystemCapability.ArkUI.ArkUI.Full 693 694| Name | Value | Description | 695| -------- | ---- | ---------------------- | 696| DEFAULT | 0 | The toast is shown within the application. | 697| TOP_MOST | 1 | The toast is shown above the application.| 698 699## ShowDialogOptions 700 701Describes the options for showing the dialog box. 702 703**System capability**: SystemCapability.ArkUI.ArkUI.Full 704 705| Name | Type | Mandatory| Description | 706| --------------------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 707| title | string \| [Resource](arkui-ts/ts-types.md#resource) | No | Title of the dialog box.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 708| message | string \| [Resource](arkui-ts/ts-types.md#resource) | No | Text body.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 709| buttons | Array<[Button](#button)> | No | Array of buttons in the dialog box. The array structure is {text:'button', color: '\#666666'}. More than one button is supported.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 710| alignment<sup>10+</sup> | [DialogAlignment](arkui-ts/ts-methods-alert-dialog-box.md#dialogalignment) | No | Alignment mode of the dialog box in the vertical direction.<br>Default value: **DialogAlignment.Default**<br>**NOTE**<br>If **showInSubWindow** is set to **true** in **UIExtension**, the dialog box is aligned with the host window based on **UIExtension**.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 711| offset<sup>10+</sup> | [Offset](arkui-ts/ts-types.md#offset) | No | Offset of the dialog box based on the **alignment** settings.<br>Default value: **{ dx: 0 , dy: 0 }**<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 712| maskRect<sup>10+</sup> | [Rectangle](arkui-ts/ts-methods-alert-dialog-box.md#rectangle8) | No | Mask area of the dialog box. Events outside the mask area are transparently transmitted, and events within the mask area are not.<br>Default value: **{ x: 0, y: 0, width: '100%', height: '100%' }**<br>**NOTE**<br>**maskRect** does not take effect when **showInSubWindow** is set to **true**.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 713| showInSubWindow<sup>11+</sup> | boolean | No | Whether to show the dialog box in a subwindow when it is not in the main window.<br>Default value: **false**, meaning the dialog box is displayed within the application, not in a separate subwindow<br>**NOTE**<br>A dialog box whose **showInSubWindow** attribute is **true** cannot trigger the display of another dialog box whose **showInSubWindow** attribute is also **true**.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 714| isModal<sup>11+</sup> | boolean | No | Whether the dialog box is a modal. A modal dialog box has a mask applied, while a non-modal dialog box does not.<br>Default value: **true**<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 715| backgroundColor<sup>12+</sup> | [ResourceColor](arkui-ts/ts-types.md#resourcecolor) | No | Background color of the dialog box.<br>Default value: **Color.Transparent**<br>**NOTE**<br>When **backgroundColor** is set to a non-transparent color, **backgroundBlurStyle** must be set to **BlurStyle.NONE**; otherwise, the color display may not meet the expected effect.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 716| backgroundBlurStyle<sup>12+</sup> | [BlurStyle](arkui-ts/ts-universal-attributes-background.md#blurstyle9) | No | Background blur style of the dialog box.<br>Default value: **BlurStyle.COMPONENT_ULTRA_THICK**<br>**NOTE**<br>Setting this parameter to **BlurStyle.NONE** disables the background blur. When **backgroundBlurStyle** is set to a value other than **NONE**, do not set **backgroundColor**. If you do, the color display may not produce the expected visual effect.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 717| shadow<sup>12+</sup> | [ShadowOptions](arkui-ts/ts-universal-attributes-image-effect.md#shadowoptions) \| [ShadowStyle](arkui-ts/ts-universal-attributes-image-effect.md#shadowstyle10) | No | Shadow of the dialog box.<br> Default value on 2-in-1 devices: **ShadowStyle.OUTER_FLOATING_MD** when the dialog box is focused and **ShadowStyle.OUTER_FLOATING_SM** otherwise<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 718| enableHoverMode<sup>14+</sup> | boolean | No | Whether to enable the hover state.<br>Default value: **false**, meaning not to enable the hover state.<br>**Atomic service API**: This API can be used in atomic services since API version 14. | 719| hoverModeArea<sup>14+</sup> | [HoverModeAreaType](arkui-ts/ts-appendix-enums.md#hovermodeareatype14) | No | Display area of the dialog box in the hover state.<br>Default value: **HoverModeAreaType.BOTTOM_SCREEN**<br>**Atomic service API**: This API can be used in atomic services since API version 14.| 720| levelMode<sup>15+</sup> | [LevelMode](#levelmode15) | No | Display level of the dialog box.<br>**NOTE**<br>- Default value: **LevelMode.OVERLAY**<br>- This parameter takes effect only when **showInSubWindow** is set to **false**.<br>**Atomic service API**: This API can be used in atomic services since API version 15.| 721| levelUniqueId<sup>15+</sup> | number | No | [Unique ID](js-apis-arkui-frameNode.md#getuniqueid12) of the node under the display level for the page-level dialog box.<br>**NOTE**<br>- This parameter takes effect only when **levelMode** is set to **LevelMode.EMBEDDED**.<br>**Atomic service API**: This API can be used in atomic services since API version 15.| 722| immersiveMode<sup>15+</sup> | [ImmersiveMode](#immersivemode15) | No | Overlay effect for the page-level dialog box.<br>**NOTE**<br>- Default value: **ImmersiveMode.DEFAULT**<br>- This parameter takes effect only when **levelMode** is set to **LevelMode.EMBEDDED**.<br>**Atomic service API**: This API can be used in atomic services since API version 15.| 723 724## ShowDialogSuccessResponse 725 726Describes the dialog box response result. 727 728**Atomic service API**: This API can be used in atomic services since API version 11. 729 730**System capability**: SystemCapability.ArkUI.ArkUI.Full 731 732| Name | Type | Mandatory| Description | 733| ----- | ------ | ---- | ------------------------------- | 734| index | number | Yes | Index of the selected button in the **buttons** array.| 735 736## ActionMenuOptions 737 738Describes the options for showing the action menu. 739 740**System capability**: SystemCapability.ArkUI.ArkUI.Full 741 742| Name | Type | Mandatory| Description | 743| ----------------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 744| title | string \| [Resource](arkui-ts/ts-types.md#resource) | No | Title of the dialog box.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 745| buttons | [[Button](#button),[Button](#button)?,[Button](#button)?,[Button](#button)?,[Button](#button)?,[Button](#button)?] | Yes | Array of menu item buttons. The array structure is **{text:'button', color: '\#666666'}**. Up to six buttons are supported. If there are more than six buttons, only the first six buttons will be displayed.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 746| showInSubWindow<sup>11+</sup> | boolean | No | Whether to show the dialog box in a subwindow when it is not in the main window.<br>Default value: **false**, indicating that the dialog box is not displayed in the subwindow<br>**NOTE**<br> - A dialog box whose **showInSubWindow** attribute is **true** cannot trigger the display of another dialog box whose **showInSubWindow** attribute is also **true**.<br> - If **showInSubWindow** is set to **true** in **UIExtension**, the dialog box is aligned with the host window based on **UIExtension**.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 747| isModal<sup>11+</sup> | boolean | No | Whether the dialog box is a modal. A modal dialog box has a mask applied, while a non-modal dialog box does not.<br>Default value: **true**<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 748| levelMode<sup>15+</sup> | [LevelMode](#levelmode15) | No | Display level of the dialog box.<br>**NOTE**<br>- Default value: **LevelMode.OVERLAY**<br>- This parameter takes effect only when **showInSubWindow** is set to **false**.<br>**Atomic service API**: This API can be used in atomic services since API version 15.| 749| levelUniqueId<sup>15+</sup> | number | No | [Unique ID](js-apis-arkui-frameNode.md#getuniqueid12) of the node under the display level for the page-level dialog box.<br>**NOTE**<br>- This parameter takes effect only when **levelMode** is set to **LevelMode.EMBEDDED**.<br>**Atomic service API**: This API can be used in atomic services since API version 15.| 750| immersiveMode<sup>15+</sup> | [ImmersiveMode](#immersivemode15) | No | Overlay effect for the page-level dialog box.<br>**NOTE**<br>- Default value: **ImmersiveMode.DEFAULT**<br>- This parameter takes effect only when **levelMode** is set to **LevelMode.EMBEDDED**.<br>**Atomic service API**: This API can be used in atomic services since API version 15.| 751 752## ActionMenuSuccessResponse 753 754Describes the action menu response result. 755 756**Atomic service API**: This API can be used in atomic services since API version 11. 757 758**System capability**: SystemCapability.ArkUI.ArkUI.Full 759 760| Name | Type | Mandatory| Description | 761| ----- | ------ | ---- | ---------------------------------------- | 762| index | number | Yes | Index of the selected button in the **buttons** array, starting from **0**.| 763 764## CustomDialogOptions<sup>11+</sup> 765 766Defines the options of a custom dialog box, which inherit from [BaseDialogOptions](#basedialogoptions11). 767 768**Atomic service API**: This API can be used in atomic services since API version 12. 769 770**System capability**: SystemCapability.ArkUI.ArkUI.Full 771 772| Name | Type | Mandatory| Description | 773| ------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ | 774| builder | [CustomBuilder](arkui-ts/ts-types.md#custombuilder8) | Yes | Content of the custom dialog box.<br>**NOTE**<br>The builder needs to be assigned an arrow function in the following format: () => { this.XXX() }, where XXX indicates the internal builder name.<br>If you are working with a global builder, you need to call it within a local builder within a component.<br>The aspect ratio of the root node of a builder is relative to the size of the dialog box container.<br>The aspect ratio of a non-root node is relative to the size of its parent node.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 775| backgroundColor <sup>12+</sup>| [ResourceColor](arkui-ts/ts-types.md#resourcecolor) | No| Background color of the dialog box.<br>Default value: **Color.Transparent**<br>**NOTE**<br>When **backgroundColor** is set to a non-transparent color, **backgroundBlurStyle** must be set to **BlurStyle.NONE**; otherwise, the color display may not meet the expected effect.| 776| cornerRadius<sup>12+</sup>| [Dimension](arkui-ts/ts-types.md#dimension10) \| [BorderRadiuses](arkui-ts/ts-types.md#borderradiuses9) | No| Radius of the rounded corners of the background.<br>You can set separate radiuses for the four rounded corners.<br>Default value: **{ topLeft: '32vp', topRight: '32vp', bottomLeft: '32vp', bottomRight: '32vp' }**<br> The radius of the rounded corners is subject to the component size. Its maximum value is half of the component width or height. If the value is negative, the default value is used.<br> When set to a percentage, the value defines the radius as a percentage of the parent component's width or height.| 777| borderWidth<sup>12+</sup>| [Dimension](arkui-ts/ts-types.md#dimension10) \| [EdgeWidths](arkui-ts/ts-types.md#edgewidths9) | No| Border width of the dialog box.<br>You can set the width for all four sides or set separate widths for individual sides.<br>Default value: **0**<br> When set to a percentage, the value defines the border width as a percentage of the parent dialog box's width.<br>If the left and right borders are greater than its width, or the top and bottom borders are greater than its height, the dialog box may not display as expected.| 778| borderColor<sup>12+</sup> | [ResourceColor](arkui-ts/ts-types.md#resourcecolor) \| [EdgeColors](arkui-ts/ts-types.md#edgecolors9) | No| Border color of the dialog box.<br>Default value: **Color.Black**<br> **borderColor** must be used with **borderWidth** in pairs.| 779| borderStyle<sup>12+</sup> | [BorderStyle](arkui-ts/ts-appendix-enums.md#borderstyle) \| [EdgeStyles](arkui-ts/ts-types.md#edgestyles9) | No| Border style of the dialog box.<br>Default value: **BorderStyle.Solid**<br> **borderStyle** must be used with **borderWidth** in pairs.| 780| width<sup>12+</sup> | [Dimension](arkui-ts/ts-types.md#dimension10) | No | Width of the dialog box.<br>**NOTE**<br>- Default maximum width of the dialog box: 400 vp<br>- When this parameter is set to a percentage, the reference width of the dialog box is the width of the window where the dialog box is located. You can decrease or increase the width as needed.| 781| height<sup>12+</sup> | [Dimension](arkui-ts/ts-types.md#dimension10) | No | Height of the dialog box.<br>**NOTE**<br>- Default maximum height of the dialog box: 0.9 x (Window height – Safe area)<br>- When this parameter is set to a percentage, the reference height of the dialog box is the height of the window where the dialog box is located minus the safe area. You can decrease or increase the height as needed.| 782| shadow<sup>12+</sup>| [ShadowOptions](arkui-ts/ts-universal-attributes-image-effect.md#shadowoptions) \| [ShadowStyle](arkui-ts/ts-universal-attributes-image-effect.md#shadowstyle10) | No| Shadow of the dialog box.<br>Default value on 2-in-1 devices: **ShadowStyle.OUTER_FLOATING_MD** when the dialog box is focused and **ShadowStyle.OUTER_FLOATING_SM** otherwise| 783| backgroundBlurStyle<sup>12+</sup> | [BlurStyle](arkui-ts/ts-universal-attributes-background.md#blurstyle9) | No | Background blur style of the dialog box.<br>Default value: **BlurStyle.COMPONENT_ULTRA_THICK**<br>**NOTE**<br>Setting this parameter to **BlurStyle.NONE** disables the background blur. When **backgroundBlurStyle** is set to a value other than **NONE**, do not set **backgroundColor**. If you do, the color display may not produce the expected visual effect.| 784 785## BaseDialogOptions<sup>11+</sup> 786 787Defines the options of the dialog box. 788 789**System capability**: SystemCapability.ArkUI.ArkUI.Full 790 791| Name | Type | Mandatory| Description | 792| --------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 793| maskRect | [Rectangle](arkui-ts/ts-methods-alert-dialog-box.md#rectangle8) | No | Mask area.<br>Default value: **{ x: 0, y: 0, width: '100%', height: '100%' }**<br>**NOTE**<br>**maskRect** does not take effect when **showInSubWindow** is set to **true**.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 794| alignment | [DialogAlignment](arkui-ts/ts-methods-alert-dialog-box.md#dialogalignment) | No | Alignment mode of the dialog box in the vertical direction.<br>Default value: **DialogAlignment.Default**<br>**NOTE**<br>If **showInSubWindow** is set to **true** in **UIExtension**, the dialog box is aligned with the host window based on **UIExtension**.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 795| offset | [Offset](arkui-ts/ts-types.md#offset) | No | Offset of the dialog box based on the **alignment** settings.<br>Default value: **{ dx: 0 , dy: 0 }**<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 796| isModal | boolean | No | Whether the dialog box is a modal. A modal dialog box has a mask applied, while a non-modal dialog box does not.<br>Default value: **true**<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 797| showInSubWindow | boolean | No | Whether to show the dialog box in a subwindow when it is not in the main window.<br>Default value: **false**, meaning the dialog box is displayed within the application, not in a separate subwindow<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 798| onWillDismiss<sup>12+</sup> | Callback<[DismissDialogAction](#dismissdialogaction12)> | No| Callback for interactive dismissal of the dialog box.<br>**NOTE**<br>1. If this callback is registered, the dialog box will not be dismissed immediately after the user touches the mask or the Back button, presses the Esc key, or swipes left or right on the screen. The **reason** parameter in the callback is used to determine whether the dialog box can be dismissed. The reason returned by the component does not support the value **CLOSE_BUTTON**.<br>2. In the **onWillDismiss** callback, another **onWillDismiss** callback is not allowed.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 799| autoCancel<sup>12+</sup> | boolean | No | Whether to dismiss the dialog box when the mask is touched. The value **true** means to dismiss the dialog box when the mask is touched, and **false** means the opposite.<br>Default value: **true**<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 800| maskColor<sup>12+</sup> | [ResourceColor](arkui-ts/ts-types.md#resourcecolor) | No | Mask color.<br>Default value: **0x33000000**<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 801| transition<sup>12+</sup> | [TransitionEffect](arkui-ts/ts-transition-animation-component.md#transitioneffect10) | No | Transition effect for the entrance and exit of the dialog box.<br>**NOTE**<br> 1. If this parameter is not set, the default effect is used.<br> 2. Touching the Back button during the entrance animation pauses the entrance animation and starts the exit animation. The final effect is one obtained after the curves of the entrance and exit animations are combined.<br> 3. Touching the Back button during the exit animation does not affect the animation playback. Touching the Back button again closes the application.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 802| onDidAppear<sup>12+</sup> | () => void | No| Event callback when the dialog box appears.<br>**NOTE**<br>1. The normal timing sequence is as follows: onWillAppear > onDidAppear > (onDateAccept/onCancel/onDateChange) > onWillDisappear > onDidDisappear.<br>2. You can set the callback event for changing the dialog box display effect in **onDidAppear**. The settings take effect next time the dialog box appears.<br>3. If the user dismisses the dialog box immediately after it appears, **onWillDisappear** is invoked before **onDidAppear**.<br>4. If the dialog box is dismissed before its entrance animation is finished, this callback is not invoked.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 803| onDidDisappear<sup>12+</sup> | () => void | No| Event callback when the dialog box disappears.<br>**NOTE**<br>The normal timing sequence is as follows: onWillAppear > onDidAppear > (onDateAccept/onCancel/onDateChange) > onWillDisappear > onDidDisappear.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 804| onWillAppear<sup>12+</sup> | () => void | No| Event callback when the dialog box is about to appear.<br>**NOTE**<br>1. The normal timing sequence is as follows: onWillAppear > onDidAppear > (onDateAccept/onCancel/onDateChange) > onWillDisappear > onDidDisappear.<br>2. You can set the callback event for changing the dialog box display effect in **onWillAppear**. The settings take effect next time the dialog box appears.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 805| onWillDisappear<sup>12+</sup> | () => void | No| Event callback when the dialog box is about to disappear.<br>**NOTE**<br>1. The normal timing sequence is as follows: onWillAppear > onDidAppear > (onDateAccept/onCancel/onDateChange) > onWillDisappear > onDidDisappear.<br>2. If the user dismisses the dialog box immediately after it appears, **onWillDisappear** is invoked before **onDidAppear**.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 806| keyboardAvoidMode<sup>12+</sup> | [KeyboardAvoidMode](./arkui-ts/ts-types.md#keyboardavoidmode12) | No| How the dialog box avoids the soft keyboard when it is brought up.<br>Default value: **KeyboardAvoidMode.DEFAULT**<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 807| enableHoverMode<sup>14+</sup> | boolean | No | Whether to enable the hover state.<br>Default value: **false**, meaning not to enable the hover state.<br>**Atomic service API**: This API can be used in atomic services since API version 14.| 808| hoverModeArea<sup>14+</sup> | [HoverModeAreaType](arkui-ts/ts-appendix-enums.md#hovermodeareatype14) | No | Display area of the dialog box in the hover state.<br>Default value: **HoverModeAreaType.BOTTOM_SCREEN**<br>**Atomic service API**: This API can be used in atomic services since API version 14.| 809| keyboardAvoidDistance<sup>15+</sup> | [LengthMetrics](js-apis-arkui-graphics.md#lengthmetrics12) | No | Minimum distance between the dialog box and the keyboard after keyboard avoidance is applied.<br>**NOTE**<br>- Default value: **16vp**<br>- Default unit: vp<br>- This parameter takes effect only when **keyboardAvoidMode** is set to **DEFAULT**.<br>**Atomic service API**: This API can be used in atomic services since API version 16.| 810| levelMode<sup>15+</sup> | [LevelMode](#levelmode15) | No | Display level of the dialog box.<br>**NOTE**<br>- Default value: **LevelMode.OVERLAY**<br>- This parameter takes effect only when **showInSubWindow** is set to **false**.<br>**Atomic service API**: This API can be used in atomic services since API version 15.| 811| levelUniqueId<sup>15+</sup> | number | No | [Unique ID](js-apis-arkui-frameNode.md#getuniqueid12) of the node under the display level for the page-level dialog box.<br>**NOTE**<br>- This parameter takes effect only when **levelMode** is set to **LevelMode.EMBEDDED**.<br>**Atomic service API**: This API can be used in atomic services since API version 15.| 812| immersiveMode<sup>15+</sup> | [ImmersiveMode](#immersivemode15) | No | Overlay effect for the page-level dialog box.<br>**NOTE**<br>- Default value: **ImmersiveMode.DEFAULT**<br>- This parameter takes effect only when **levelMode** is set to **LevelMode.EMBEDDED**.<br>**Atomic service API**: This API can be used in atomic services since API version 15.| 813 814## DismissDialogAction<sup>12+</sup> 815 816Provides information about the action to dismiss the dialog box. 817 818**Atomic service API**: This API can be used in atomic services since API version 12. 819 820**System capability**: SystemCapability.ArkUI.ArkUI.Full 821 822### Attributes 823 824| Name | Type | Readable| Writable| Description | 825| ------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ | 826| dismiss | Callback<void> | No | No | Callback for dismissing the dialog box. This API is called only when the dialog box needs to be exited.| 827| reason | [DismissReason](#dismissreason12) | No | No | Reason why the dialog box cannot be dismissed. You must specify whether to dismiss the dialog box for each of the listed actions.| 828 829## DismissReason<sup>12+</sup> 830 831**Atomic service API**: This API can be used in atomic services since API version 12. 832 833**System capability**: SystemCapability.ArkUI.ArkUI.Full 834 835| Name | Value | Description | 836| ------------- | ---- | ------------------------------------------------------------ | 837| PRESS_BACK | 0 | Touching the Back button, swiping left or right on the screen, or pressing the Esc key. | 838| TOUCH_OUTSIDE | 1 | Touching the mask. | 839| CLOSE_BUTTON | 2 | Touching the Close button. | 840| SLIDE_DOWN | 3 | Sliding down.<br>**NOTE**<br>This API is effective only in [sheet transition](./arkui-ts/ts-universal-attributes-sheet-transition.md).| 841 842## LevelMode<sup>15+</sup> 843 844Enumerates the display level modes of the dialog box. 845 846**Atomic service API**: This API can be used in atomic services since API version 15. 847 848**System capability**: SystemCapability.ArkUI.ArkUI.Full 849 850| Name | Value | Description | 851| ------- | ---- | ------------------------------------------------ | 852| OVERLAY | 0 | The dialog box is displayed at the root node level of the application window and remain visible during navigation.| 853| EMBEDDED | 1 | The dialog box is a child of the page's route/navigation and is hidden when the page is hidden.| 854 855## ImmersiveMode<sup>15+</sup> 856 857Enumerates the display area modes of the dialog box overlay within a page. 858 859**Atomic service API**: This API can be used in atomic services since API version 15. 860 861**System capability**: SystemCapability.ArkUI.ArkUI.Full 862 863| Name | Value | Description | 864| ------- | ---- | ------------------------------------------------ | 865| DEFAULT | 0 | The dialog box overlay follows the layout constraints of its parent node.| 866| EXTEND | 1 | The dialog box overlay can extend to cover the status bar and navigation bar for a more immersive look. 867 868## Button 869 870Describes the menu item button in the action menu. 871 872**System capability**: SystemCapability.ArkUI.ArkUI.Full 873 874| Name | Type | Mandatory | Description | 875| ----- | ---------------------------------------- | ---- | ------- | 876| text | string \| [Resource](arkui-ts/ts-types.md#resource)| Yes | Button text.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 877| color | string \| [Resource](arkui-ts/ts-types.md#resource) | Yes | Text color of the button.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 878| primary<sup>12+</sup> | boolean | No | Whether the button responds to the **Enter** key by default when the dialog box has focus and the **Tab** key is not pressed for sequential focus navigation. If there are multiple buttons, set this parameter to **true** for only one button. Otherwise, no button will respond. Multiple dialog boxes can automatically gain focus and respond to user interactions in a sequential manner.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 879