mcpField
S
syncfusion-aspnetcore-popups

syncfusion-aspnetcore-popups

github.com/syncfusionデザイン・UI0101 回インストール3 週間前に更新
リポジトリ

syncfusion-aspnetcore-popups について

ASP.NET Core 開発者向けに、Syncfusion のポップアップ実装を案内するスキルです。Dialog、定義済みダイアログ、Tooltip の設定や操作、アクセシビリティを扱います。

主な機能

  1. 01Dialog と定義済みダイアログの設定
  2. 02ツールチップの起動方法と配置設定
  3. 03アニメーション、テンプレート、スタイルのカスタマイズ
  4. 04キーボードとアクセシビリティの設定

活用シーン

  1. 01確認・通知ダイアログの構築
  2. 02画面上のコントロールへのヒント追加

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/syncfusion/aspnetcore-ui-components-skills --skill syncfusion-aspnetcore-popups

インストール後、Claude Code で/syncfusion-aspnetcore-popupsを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

references/
dialog-accessibility-and-localization.md
dialog-animations-and-transitions.md
dialog-api.md
dialog-basic-features.md
dialog-events-and-interactions.md
dialog-getting-started.md
dialog-positioning-and-sizing.md
dialog-styling-and-themes.md
dialog-templates.md
predefineddialog-animation.md
predefineddialog-api.md
predefineddialog-customization.md
predefineddialog-dimension.md
predefineddialog-draggable.md
predefineddialog-getting-started.md
predefineddialog-position.md
tooltip-accessibility.md
tooltip-animation.md
tooltip-api.md
tooltip-content.md
tooltip-customization.md
tooltip-getting-started.md
tooltip-open-mode.md
tooltip-positioning.md

詳細

Syncfusion ASP.NET Core ポップアップ

ダイアログ

このスキルでは、<ejs-dialog> Tag Helper API を使用して、ASP.NET Core アプリケーションで Syncfusion Dialog を実装、設定、カスタマイズする方法を説明します。セットアップ、モーダル表示、配置、アニメーション、テンプレート、イベント、アクセシビリティ、スタイル設定を扱います。

クイックリンク
クイックスタート(Tag Helper)

Razor ビューで次のように記述します。

@using Syncfusion.EJ2

<ejs-dialog id="dialog" header="Welcome" isModal="true" width="500px">
    <e-content-template>
        <p>This is a basic dialog with default settings.</p>
    </e-content-template>
</ejs-dialog>

<script>
    window.onload = function () {
        document.getElementById('openBtn').onclick = function () {
            document.getElementById('dialog').ej2_instances[0].show();
        };
    };
</script>

レイアウト(_Layout.cshtml)にスクリプトマネージャーとスタイルを含めてください。


<link rel="stylesheet" href="https://cdn.syncfusion.com/ej2/{{ site.ej2version }}/fluent.css" />


<script src="https://cdn.syncfusion.com/ej2/{{ site.ej2version }}/dist/ej2.min.js"></script>
<ejs-scripts></ejs-scripts>
よく使われるパターン
モーダル確認ダイアログ
<ejs-dialog id="confirmDialog" header="Confirm Action" isModal="true" width="400px">
    <e-dialog-buttons>
        <e-dialog-dialogbutton content="Yes" isPrimary="true" click="confirmAction"></e-dialog-dialogbutton>
        <e-dialog-dialogbutton content="No" click="closeDialog"></e-dialog-dialogbutton>
    </e-dialog-buttons>
    <e-content-template>
        <p>Are you sure you want to proceed?</p>
    </e-content-template>
</ejs-dialog>
ヘッダー付きのドラッグ可能なダイアログ
<ejs-dialog id="draggableDialog" 
    header="Drag Me" 
    allowDragging="true" 
    width="500px" 
    showCloseIcon="true">
    <e-content-template>
        <p>Grab the header to drag this dialog.</p>
    </e-content-template>
</ejs-dialog>
中央配置のダイアログ
<ejs-dialog id="centeredDialog" 
    header="Centered Position" 
    width="500px">
    <e-dialog-position x="center" y="center"></e-dialog-position>
    <e-content-template>
        <p>This dialog is centered on the page.</p>
    </e-content-template>
</ejs-dialog>
主なプロパティ
Tag Helper 属性型用途例
headerstringダイアログのタイトルバーのテキストheader="Confirm Delete"
isModalboolダイアログの背後にオーバーレイを表示isModal="true"
widthstringダイアログの幅(px、%)width="500px"
heightstringダイアログの高さ(px、%)height="300px"
minHeightstringダイアログの最小の高さminHeight="150px"
allowDraggingboolドラッグによる位置変更を有効化allowDragging="true"
enableResizeboolユーザーによるサイズ変更を有効化enableResize="true"
showCloseIconbool閉じる(X)ボタンを表示showCloseIcon="true"
closeOnEscapeboolEscape キーで閉じるcloseOnEscape="true"
visiblebool初期表示状態visible="false"
targetstring対象コンテナーのセレクターtarget="#container"
cssClassstringカスタム CSS クラスcssClass="my-dialog"
enableRtlbool右から左への表示enableRtl="true"
enablePersistencebool再読み込み後も状態を保持enablePersistence="true"
zIndexdouble重なり順のレベルzIndex="2000"
<e-dialog-position>DialogPositionDataX/Y の位置指定x="center" y="center"
<e-dialog-animationsettings>DialogAnimationSettings開閉アニメーションeffect="Zoom" duration="400"
footerTemplatestringカスタムフッター HTML 文字列footerTemplate="<span>...</span>"

削除された無効な API: is-hidden(visible="false" を使用)、position-x/position-y の単独属性(<e-dialog-position> を使用)、allow-resizing(enable-resize を使用)、max-height、max-width、min-width(サポート対象外)。

次のステップ

インストール手順、NuGet パッケージのセットアップ、設定の詳細については、getting-started.md をお読みください。

定義済みダイアログ

定義済みダイアログは、DialogUtility JavaScript ユーティリティクラスを使用して命令的に開きます。コンポーネントをセットアップすることなく、すぐに使えるアラート、確認、プロンプトのダイアログを提供します。簡単な通知やユーザー確認には、定義済みダイアログを使用してください。

主な概念

定義済みダイアログは、Tag Helper コンポーネントではありません。JavaScript を使って呼び出します。

ej.popups.DialogUtility.alert({ ... });
ej.popups.DialogUtility.confirm({ ... });

クイックスタート
<button class="e-btn e-danger" onclick="showAlert()">Alert</button>

<script>
    function showAlert() {
        ej.popups.DialogUtility.alert({
            title: 'Low Battery',
            width: '250px',
            content: '10% of battery remaining'
        });
    }
</script>

ドキュメントガイド
はじめに

📄 参照: references/predefineddialog-getting-started.md

  • インストールとセットアップ
  • Alert、Confirm、Prompt の基本例
  • JavaScript による呼び出しパターン
位置

📄 参照: references/predefineddialog-position.md

  • X/Y 値を指定する position プロパティ
  • 中央、上、下、左、右への配置
  • ピクセル単位のカスタムオフセット
アニメーション

📄 読む: references/predefineddialog-animation.md

  • エフェクト、時間、遅延を指定する animationSettings
  • Alert、Confirm、Prompt のアニメーション例
ドラッグ可能

📄 読む: references/predefineddialog-draggable.md

  • ブール型プロパティ isDraggable
  • ダイアログをドラッグして位置を変更する例
サイズ

📄 読む: references/predefineddialog-dimension.md

  • width および height プロパティ
  • サイズ制約(min-width、max-width)を指定する cssClass
カスタマイズ

📄 読む: references/predefineddialog-customization.md

  • okButton / cancelButton のカスタマイズ
  • showCloseIcon と closeOnEscape
  • HTML 文字列を使ったカスタムコンテンツ
API リファレンス

📄 読む: references/predefineddialog-api.md

  • DialogUtility.alert() / confirm() の全オプションプロパティ
  • サポートされているすべてのフィールドと型

よく使われるパターン

アラートダイアログ:

ej.popups.DialogUtility.alert({
    title: 'Info',
    content: 'Operation complete.',
    width: '250px'
});

確認ダイアログ:

var dialogObj = ej.popups.DialogUtility.confirm({
    title: 'Delete?',
    content: 'Are you sure?',
    width: '300px',
    okButton: { text: 'Yes', click: function() { /* delete */ dialogObj.hide(); } },
    cancelButton: { text: 'No', click: function() { dialogObj.hide(); } }
});

プロンプトダイアログ:

var dialogObj = ej.popups.DialogUtility.confirm({
    title: 'Enter Name',
    content: '<p>Your name:</p><input id="nameInput" class="e-input" placeholder="Type here..." />',
    width: '300px',
    okButton: { text: 'Submit', click: function() { var val = document.getElementById('nameInput').value; dialogObj.hide(); } },
    cancelButton: { click: function() { dialogObj.hide(); } }
});

ツールチップ

ユーザーが要素にカーソルを合わせる、クリックする、またはフォーカスを当てたときに、役立つ情報やヒントを表示するツールチップコンポーネントです。<ejs-tooltip> タグヘルパーは、柔軟な位置指定、アニメーション、複数のトリガーモード、アクセシビリティ機能を提供します。

パッケージ: Syncfusion.EJ2.AspNet.Core
タグヘルパー: <ejs-tooltip>

クイックスタート
<ejs-tooltip id="tooltip" target="#target" position="TopCenter" content="Tooltip Content">
    <e-content-template>
        <button class="e-btn" id="target">Show Tooltip</button>
    </e-content-template>
</ejs-tooltip>

ドキュメントガイド
導入とセットアップ

📄 読む: references/tooltip-getting-started.md

  • インストールと CSS のインポート
  • 単一の要素に表示する基本的なツールチップ
  • title 属性を使った複数ターゲットのツールチップ
  • アプリケーションの実行
コンテンツ

📄 読む: references/tooltip-content.md

  • 文字列コンテンツと HTML マークアップ
  • <e-content-template> によるテンプレートコンテンツ
  • beforeRender イベントによる動的コンテンツ
  • セキュリティのための HTML サニタイズ
位置指定

📄 読む: references/tooltip-positioning.md

  • 12 種類の静的な位置(TopLeft、TopCenter、TopRight、BottomLeft など)
  • ヒントポインターの位置(Start、Middle、End)
  • refresh() メソッドによる動的な位置指定
  • オフセット値(offsetX、offsetY)
  • 衝突処理(windowCollision)
表示モード

📄 読む: references/tooltip-open-mode.md

  • opensOn を使った Auto、Hover、Click、Focus、Custom モード
  • 複数モードの組み合わせ(例:opensOn="Hover Click")
  • 閉じるボタン付きの固定表示モード(isSticky)
  • 表示/非表示の遅延(openDelay、closeDelay)
アニメーション

📄 読む: references/tooltip-animation.md

  • 開閉エフェクトを指定する <e-tooltip-animationsettings>
  • 7 種類以上のアニメーションエフェクト(FadeIn、ZoomIn、SlideUp など)
  • 時間と遅延の設定
  • effect: 'None' でアニメーションを無効化
カスタマイズ

📄 読む: references/tooltip-customization.md

  • カスタムスタイルを指定する cssClass
  • ヒントポインターの表示とカスタマイズ
  • 寸法(width、height)
  • RTL サポート(enableRtl)
  • マウス追従(mouseTrail)
アクセシビリティ

📄 読む: references/tooltip-accessibility.md

  • WCAG 2.2 および Section 508 への準拠
  • ARIA 属性(role、aria-describedby、aria-hidden)
  • キーボード操作(Tab、Escape)
  • スクリーンリーダーのサポートとフォーカス管理
  • アクセシブルなツールチップのベストプラクティス
API リファレンス

📄 読む: references/tooltip-api.md

  • 型とデフォルト値を含むすべてのプロパティ
  • メソッド:open()、close()、refresh()、destroy()、dataBind()
  • イベント:BeforeRender、AfterOpen、AfterClose、Created、Destroyed
  • Position と TipPointerPosition の列挙値

一般的なパターン

ボタンの基本的なツールチップ:

<ejs-tooltip id="tooltip" target="#target" position="TopCenter" content="Submit the form">
    <e-content-template>
        <button class="e-btn" id="target">Submit</button>
    </e-content-template>
</ejs-tooltip>

複数ターゲットのツールチップ:

<ejs-tooltip id="tooltip" target=".info-icon" position="TopCenter">
    <e-content-template>
        <button class="e-btn info-icon" title="Information">Info 1</button>
        <button class="e-btn info-icon" title="Details">Info 2</button>
        <button class="e-btn info-icon" title="Help">Info 3</button>
    </e-content-template>
</ejs-tooltip>

クリックで表示する固定ツールチップ:

<ejs-tooltip target="#target" content="Click the × to close me" 
    opensOn="Click" 
    isSticky="true" 
    position="BottomCenter">
    <e-content-template>
        <button id="target" class="e-btn">Click Me</button>
    </e-content-template>
</ejs-tooltip>

プログラムによる開閉:

<ejs-tooltip id="tooltip" target="#target" content="Tooltip opened programmatically" opensOn="Custom">
    <e-content-template>
        <button id="target" class="e-btn" onclick="toggleTooltip()">Toggle Tooltip</button>
    </e-content-template>
</ejs-tooltip>

<script>
    function toggleTooltip() {
        var tooltipObj = document.getElementById('tooltip').ej2_instances[0];
        var btn = document.querySelector('.e-btn');
        
        if (btn.getAttribute('data-tooltip-open') === 'true') {
            tooltipObj.close();
            btn.setAttribute('data-tooltip-open', 'false');
        } else {
            tooltipObj.open(btn);
            btn.setAttribute('data-tooltip-open', 'true');
        }
    }
</script>

主なプロパティの一覧
タグヘルパー属性型デフォルト目的
contentstring—ツールチップのテキストまたは HTML
targetstring—複数ターゲットモード用の CSS セレクター
positionPosition'TopCenter'12 種類の配置値
opensOnstring'Auto'ホバー/クリック/フォーカス/カスタム
isStickyboolfalseユーザーが閉じるまで表示を維持
mouseTrailboolfalseマウスカーソルに追従
showTipPointerbooltrue矢印の先端を表示/非表示
tipPointerPositionTipPointerPosition'Auto'自動/開始/中央/終了
openDelaynumber0表示開始までの遅延(ミリ秒)
closeDelaynumber0閉じるまでの遅延(ミリ秒)
offsetX / offsetYnumber0ターゲットからの距離(ピクセル)
width / heightstring | number'auto'ツールチップの寸法
cssClassstringnullカスタム CSS クラス
enableRtlboolfalse右から左への描画
enableHtmlSanitizerbooltrueHTML コンテンツをサニタイズ
windowCollisionboolfalseビューポートとの衝突を検出

コメント