モーダル (Modal)

タイトル、コンテンツ領域、およびアクションボタンを提供するモーダルダイアログボックスを表示します。

いつ使うか

ユーザーのワークフローを中断するために新しいページにジャンプすることなく、アプリケーションと対話する必要がある場合、Modalを使用して現在のページ上に新しいオーバーレイレイヤーを作成し、ユーザーからのフィードバックや情報を取得できます。

基本

基本的なモーダル。

Edit Profile

Make changes to your profile here. Click save when you're done.

情報モーダルダイアログ

さまざまなタイプの情報モーダルダイアログでは、ダイアログを閉じるためのボタンが1つだけ提供されます。

カスタマイズされたパーツ

カスタマイズされたフッターボタンバーまたはヘッダーを定義する、より複雑な例。

A

Custom Header

This modal cannot be closed by clicking outside or pressing Escape because `closable=`. You must provide a button to close it.

Utility Methods

The Modal component automatically exposes window.Modal.open(id) and window.Modal.close(id) global utilities to make it easy to trigger modals from anywhere in your client-side JavaScript.

script.html
<script>
  // Open a modal programmatically
  window.Modal.open('my-modal');

  // Close a modal programmatically
  window.Modal.close('my-modal');
</script>

API Reference

プロパティ
説明
タイプ
デフォルト

id

モーダルの一意の識別子。開閉に必要です。 string -

title

モーダルヘッダーのオプションのタイトルテキスト。 string -

description

タイトルの下に表示されるオプションの説明テキスト。 string -

variant

アイコンと境界線の色を決定するセマンティックスタイルバリアント。 'default' | 'success' | 'error' | 'info' | 'warning' 'default'

closable

trueの場合、閉じるボタンを表示し、背景やESCキーでの非表示を許可します。 boolean true

draggable

trueの場合、ユーザーがヘッダーをつかんでモーダルをドラッグできます。 boolean false

resizable

trueの場合、ユーザーが右下からモーダルのサイズを変更できます。 boolean false

width

カスタムの幅(例:"600px"、"80vw")。 string -

height

カスタムの高さ(例:"400px"、"50vh")。 string -