> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-docs-recommend-assets-api.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ダイアログ API

ダイアログ API は、デスクトップ環境と Web 環境で一貫して動作する標準化されたダイアログを提供します。拡張機能の開発者にとって、`prompt` および `confirm` メソッドが最も有用でしょう。

## 基本的な使い方

### プロンプトダイアログ

```javascript theme={null}
// プロンプトダイアログを表示
app.extensionManager.dialog.prompt({
  title: "ユーザー入力",
  message: "名前を入力してください：",
  defaultValue: "User"
}).then(result => {
  if (result !== null) {
    console.log(`入力：${result}`);
  }
});
```

### 確認ダイアログ

```javascript theme={null}
// 確認ダイアログを表示
app.extensionManager.dialog.confirm({
  title: "アクションの確認",
  message: "続行してもよろしいですか？",
  type: "default"
}).then(result => {
  console.log(result ? "ユーザーが確認しました" : "ユーザーがキャンセルしました");
});
```

## API リファレンス

### Prompt

```javascript theme={null}
app.extensionManager.dialog.prompt({
  title: string,             // ダイアログのタイトル
  message: string,           // 表示するメッセージ/質問
  defaultValue?: string      // 入力フィールドの初期値（オプション）
}).then((result: string | null) => {
  // result は入力されたテキスト、キャンセルされた場合は null
});
```

### Confirm

```javascript theme={null}
app.extensionManager.dialog.confirm({
  title: string,             // ダイアログのタイトル
  message: string,           // 表示するメッセージ
  type?: "default" | "overwrite" | "delete" | "dirtyClose" | "reinstall", // ダイアログのタイプ（オプション）
  itemList?: string[],       // 表示する項目のリスト（オプション）
  hint?: string              // 表示するヒントテキスト（オプション）
}).then((result: boolean | null) => {
  // result は確認なら true、拒否なら false、キャンセルなら null
});
```

ComfyUI で利用可能なその他の専用ダイアログについては、拡張機能の開発者はソースコード内の `dialogService.ts` ファイルを参照できます。
