Shadcn Dialog Scrollingのロゴ

Shadcn Dialog Scrolling

組織
prokopai
shadcn-dialog-scrolling

Dialog/modal layout patterns in jean2 client — responsive flex scrolling, mobile PWA safe-area, padding. Load when building or fixing dialogs (DialogContent, ScrollArea not scrolling, mobile overflow/clipping, notched PWA close button).

概要

公開者prokopai
リポジトリprokop
スキル名shadcn-dialog-scrolling
スター
35
フォーク
5
同梱ファイル
指示のみ
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    prokopaiがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Shadcn Dialog Scrolling」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/prokopai/prokop/tree/main/.agents/skills/shadcn-dialog-scrolling
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/prokopai/prokop.git /tmp/prokop
mkdir -p .claude/skills
cp -r /tmp/prokop/.agents/skills/shadcn-dialog-scrolling .claude/skills/shadcn-dialog-scrolling
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでShadcn Dialog Scrollingを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にShadcn Dialog Scrollingを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Shadcn Dialog Scrollingは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Dialog Layout Patterns (jean2 client)

Procedural guide for building/fixing dialogs in packages/client/src/components/modals/.

Key files

  • Base component: packages/client/src/components/ui/dialog.tsx — DialogContent already handles safe-area centering + mobile max-height. Do not override its mobile max-h (see Pitfall #1).
  • Utility: packages/client/src/lib/utils.ts — cn() = twMerge(clsx(...)). Conflicting Tailwind classes are merged with last-wins per property group.

Step 0: Classify the dialog

TypeWhenWidth class example
SimpleContent always fits viewport (confirm, short forms)sm:max-w-[425px]
ScrollingContent may exceed viewport (lists, settings, config)sm:max-w-[800px] sm:max-h-[85vh] + flex layout

Simple dialogs: just pass width to DialogContent, done. No flex, no scroll wrapper.

Step 1: Scrolling dialog — the correct layout

tsx
<DialogContent className="flex flex-col overflow-hidden p-3 sm:p-4 gap-3 sm:gap-4 max-w-[calc(100vw-0.5rem)] sm:max-w-[800px] sm:max-h-[85vh]">
  <DialogHeader className="shrink-0">
    <DialogTitle>Title</DialogTitle>
    <DialogDescription>Subtitle</DialogDescription>
  </DialogHeader>

  {/* Scrollable content — plain div, NOT ScrollArea */}
  <div className="flex-1 min-h-0 overflow-y-auto overscroll-contain rounded-lg border">
    {/* panel content */}
  </div>
</DialogContent>

Every piece matters:

  • flex flex-col overflow-hidden on DialogContent — overrides base grid (tailwind-merge last-wins)
  • shrink-0 on header — prevents it from being squeezed
  • flex-1 min-h-0 overflow-y-auto on the scroll container — min-h-0 is mandatory; without it the flex item won't shrink below content height and will never scroll
  • overscroll-contain — prevents scroll chaining to the page behind the dialog

Step 2: Tabs + sidebar variant (Configuration/Settings pattern)

For dialogs with a left sidebar (desktop) + dropdown (mobile):

tsx
<DialogContent className="flex flex-col overflow-hidden p-3 sm:p-4 gap-3 sm:gap-4 ... sm:max-h-[85vh]">
  <DialogHeader className="shrink-0">...</DialogHeader>

  {/* Mobile dropdown */}
  <SelectTrigger className="sm:hidden w-full shrink-0" />

  <Tabs orientation="vertical" className="mt-2 flex-1 min-h-0">
    <TabsList className="hidden sm:flex flex-col h-fit w-44 shrink-0 ..." />

    {/* Scrollable content area */}
    <div className="flex-1 min-w-0 min-h-0 overflow-y-auto overscroll-contain rounded-lg border">
      <TabsContent value="x" className="mt-0">...</TabsContent>
    </div>
  </Tabs>
</DialogContent>

Step 3: Mobile padding

Panels inside the scroll area should use p-3 sm:p-4 (not bare p-4) to avoid clipping on narrow PWA screens. The dialog padding (p-3 sm:p-4) + panel padding stack, so on mobile you get 24px total instead of 32px.

Pitfalls (all hit during this work)

#1 — tailwind-merge kills base safe-area (CRITICAL)

DialogContent base has max-h-[calc(100dvh-env(safe-area-inset-top,0px))] for notch protection. If you pass max-h-[calc(100dvh-2rem)], tailwind-merge sees the same max-h group and keeps only yours — silently discarding safe-area protection. The close button ends up behind the notch. Fix: Never pass a mobile max-h. Only pass sm:max-h-[85vh] (different breakpoint, no conflict).

#2 — Radix ScrollArea doesn't scroll in flex dialogs

ScrollArea (@/components/ui/scroll-area) Root/Viewport use size-full (percentage height). When the parent's height comes from flex/max-height clamping (not explicit height), percentage height resolves to auto → ScrollArea grows to full content → never constrains → never scrolls. This is flaky across browsers, especially mobile WebKit. Tried and all failed: h-full, flex-1 min-h-0, absolute inset-0 inside relative wrapper. Fix: Replace ScrollArea with a plain <div className="flex-1 min-h-0 overflow-y-auto overscroll-contain">. Remove the ScrollArea import.

#3 — Fixed-pixel ScrollArea heights

Older dialogs (MCP, WorkspacePermissions) use <ScrollArea className="h-[400px]">. This works because fixed pixels ARE a definite height, but it's fragile (magic number, doesn't adapt). When touching these, convert to the flex pattern.

#4 — Magic-number heights

Never use h-[calc(100dvh-18rem)] or sm:h-[500px]. These don't adapt to actual dialog size. Use flex-1 min-h-0 to fill available space.

#5 — Close button behind notch

Already handled in the base DialogContent via safe-region centering (top-[calc(50dvh+env(safe-area-inset-top,0px)/2)]). Only breaks if you override mobile max-h (see #1).

#6 — Unstyled native scrollbar

Plain <div className="overflow-y-auto"> shows the browser's default scrollbar (chunky, unstyled). Add the .dialog-scrollbar class (defined in index.css) to match the app's aesthetic: thin (6px), transparent track, muted-foreground thumb at 35% opacity, 55% on hover.

#7 — Dialog height jumps when switching tabs

Using sm:max-h-[85vh] lets the dialog shrink to fit each panel's content, causing layout jumps when switching tabs. Use a fixed height h-[85dvh] sm:h-[85vh] instead so the dialog stays a constant size — only the inner scroll area changes.

Verification

  1. cd packages/client && bunx tsc --noEmit -p tsconfig.json — must pass (0 errors)
  2. bunx eslint <changed-files> — must pass
  3. Manual: open dialog on mobile PWA viewport — close button tappable, content scrolls, nothing clips

よくある質問

AIスキル「Shadcn Dialog Scrolling」では何ができますか?

Dialog/modal layout patterns in jean2 client — responsive flex scrolling, mobile PWA safe-area, padding. Load when building or fixing dialogs (DialogContent, ScrollArea not scrolling, mobile overflow/clipping, notched PWA close button).

TypingMindでShadcn Dialog Scrollingを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Shadcn Dialog Scrollingはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにShadcn Dialog Scrollingをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/prokopai/prokop/tree/main/.agents/skills/shadcn-dialog-scrollingを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Shadcn Dialog Scrollingを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Shadcn Dialog Scrollingで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもShadcn Dialog Scrollingを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Shadcn Dialog Scrolling」は無料ですか?

はい。prokopaiがApache-2.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇