Communitygithub.com

アコーディオンUIシステム

アコーディオンを使用した段階的な情報開示のための体系的なフレームワークを設計・実装し、異なるコンテンツ密度やデバイスにおいて構造的一貫性、視覚的アフォーダンス、アクセシビリティを確保します。

アコーディオンUIシステム とは?

このスキルは、積み重ねられたヘッダーをクリックすると関連コンテンツが表示される「アコーディオン」UIパターンを体系的に設計・実装するための方法論を提供します。主な目的はプログレッシブ・ディスクロージャー(段階的な情報開示)であり、ユーザーが高レベルの情報をざっと見て、どの詳細を読むかを選択できるようにすることで認知負荷を軽減します。このスキルはFAQセクション、モバイルメニュー、複雑なフォーム、商品詳細、フィルタリングなど、様々なユースケースをカバーしています。また、アコーディオンを使用すべきでない状況(コンテンツ量が少ない場合、重要な手順が含まれる場合、検索主体のページなど)も明確に示しており、誤用を防ぎます。入力としてコンテンツインベントリ、展開ロジック(排他的か複数同時展開か)、トリガーのコンテキスト、親デザインシステムのスペーシングとタイポグラフィスケールを受け取り、出力としてアコーディオンの構造仕様、インタラクション仕様、アクセシビリティ設計書、レスポンシブ戦略を生成します。ワークフローは内容の構造化、視覚的アフォーダンスの確立、インタラクションロジックの定義、スペーシングとコンテンツの最適化、アクセシビリティとレスポンシブ対応の検証の5ステップで構成されています。特にアクセシビリティには重点が置かれており、セマンティックな見出しタグとボタンの使用、ARIA属性(aria-expanded、aria-controls、role="region")、キーボード操作(Tab、Enter/Space)、WCAG 2.2の最小タッチターゲットサイズ(24x24px、推奨44x44px)への準拠が要件として含まれています。また、チェブロンルール、最初のアイテムルール、テキスト切り捨て禁止、配置の一貫性といった決定ルールも定義されており、デザインの品質を保証します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/coastdigitalgroup/coastai-skills/tree/HEAD/website-design/accordion-ui-system

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

アコーディオンUIシステム は何をしますか?

目的

アコーディオンUIシステムスキルは、積み重ねられたヘッダーを展開して関連コンテンツを表示するアコーディオンの設計と構造化のための方法論を提供します。このパターンはプログレッシブ・ディスクロージャー(段階的な情報開示)に不可欠であり、ユーザーが高レベルの情報をざっと見て、どの詳細を読むかを選択できるようにします。アコーディオンへの体系的なアプローチは、重要な情報を隠したりアクセシビリティの障壁を作ったりすることなく、認知負荷を低減します。

ユースケース

  • FAQセクション: 長い質問と回答のリストをスキャン可能なリストに整理する。
  • モバイルメニュー: セカンダリナビゲーション項目を折りたたんで縦方向のスペースを節約する。
  • 複雑なフォーム: 関連するフォームフィールドを管理可能なトグル可能なセクションにグループ化する。
  • 商品詳細: Eコマースページで技術仕様、配送情報、レビューなどを非表示にする。
  • フィルタリング: ディスカバリーサイドバーで複数のファセットグループを管理する。

使用すべきでない場合

  • コンテンツ量が少ない場合: コンテンツ全体が短い場合、クリックで隠すと不必要なインタラクションコストが発生します。
  • 重要な手順: ユーザーが先に進むために情報を必ず読まなければならない場合(例:法的警告や「使い方」の手順)、非表示にしてはいけません。
  • 検索主体のページ: ユーザーがブラウザの「検索」(Cmd/Ctrl+F)を頻繁に使用する場合;デフォルトでは非表示のアコーディオンコンテンツは検索できないことが多いためです。
  • 単一アイテムの開示: トグルするコンテンツが1つだけの場合は、単純な「もっと見る」リンクまたは単一の開示コンポーネントを使用します。

入力

  1. コンテンツインベントリ: ヘッダーとそれに対応する展開コンテンツのリスト。
  2. 展開ロジック: 一度に1つのアイテムのみ開く(排他的)か、複数開くことができるか。
  3. トリガーのコンテキスト: アコーディオンはどこに配置されるか?(例:メインコンテンツエリア、サイドバー、モバイルドロワー)
  4. 既存システム: 親デザインシステムからの流体スペーシングとタイポグラフィスケール。

出力

  1. アコーディオン構造仕様: ヘッダー、アイコン、パネル、スペーシングの視覚的定義。
  2. インタラクション仕様: 展開、フォーカス状態、トランジションの動作。
  3. アクセシビリティ設計書: ARIAロール、状態、キーボードマッピング。
  4. レスポンシブ戦略: アコーディオンが狭いビューポートに適応するためのルール。

ワークフロー

1. コンテンツの構造を定義する

アコーディオン項目の標準パーツを定義します:

  • ヘッダー(トリガー): タイトルを含むクリック可能な領域。
  • アイコン(アフォーダンス): 通常は開閉を示すシェブロンまたはプラス/マイナス記号。
  • パネル: 非表示コンテンツを保持するコンテナ。
  • グループ: 複数項目間の関係を管理する親コンテナ。

2. 視覚的アフォーダンスを確立する

visual-hierarchy-system を適用してアコーディオンが認識可能であることを確保します:

  • 状態インジケーター: アコーディオンが開いたときに回転または変化するアイコン(シェブロン)を使用します。
  • 区切り: ボーダー、背景色の変化、または (fluid-spacing-system からの)垂直スペーシングを使用して項目を区別します。
  • ヘッダー: ヘッダーテキストがインタラクティブに見えるようにします(太字または異なる色)。

3. インタラクションロジックを定義する

動作パターンを選択します:

  • 排他的(単一開く): 1つのアイテムを開くと、他のアイテムが自動的に閉じる。フォーカスとページ長の削減に最適。
  • 複数開く: 複数のアイテムを開いたままにできる。セクション間で情報を比較する必要がある場合に最適。
  • デフォルト状態: 機能を示すために最初のアイテムをデフォルトで開いておくかを決定します。

4. スペーシングとコンテンツを最適化する

内部に fluid-spacing-system を適用します:

  • ヘッダーのパディング: タッチターゲットが少なくとも 24x24px(WCAG 2.2 SC 2.5.8 最小)であることを確認し、レイアウトが許す場合は快適なタッチ使用のために 44x44px を推奨します。
  • パネルのパディング: 内部パディングを使用して、ヘッダーとそのコンテンツの間に明確な関係を作成します。
  • トランジション: コンテンツが現れるときの「ジャンプ」を和らげるために、微妙な高さまたは不透明度のトランジション(200〜300ms)を使用します。

5. アクセシビリティとレスポンシブ対応を検証する

  • キーボード: ユーザーは Tab でヘッダーに移動し、Enter/Space でトグルできなければなりません(ARIA APG アコーディオンパターンに従う)。
  • ARIA: 各トリガーを見出し要素(<h3><button aria-expanded="true/false" aria-controls="panel-id">...</button></h3>)でラップし、パネルに role="region" を与え、パネルに重要なコンテンツが含まれる場合は aria-labelledby でトリガーを指すようにします。
  • モバイル: 長いヘッダーが適切に折り返され、アイコンと重ならないようにします。

決定ルール

  • シェブロンルール: ヘッダーの右側に常に視覚的なインジケーター(シェブロンなど)を含めます。閉じているときは下向き、開いているときは上向きにします。
  • 最初のアイテムルール: 最初のアコーディオン項目に最も重要な情報または最もリクエストの多い情報が含まれている場合は、デフォルトで開いておきます。
  • テキスト切り捨て禁止: アコーディオンのヘッダーを切り詰めてはいけません。タイトルが長い場合は、複数行に折り返して明確さを確保します。
  • 配置: 展開/折りたたみトリガーアイコンの配置を一貫させ(通常は右端に揃える)、予測可能なスキャンパスを作成します。

制約

  • アクセシビリティ: ヘッダーはキーボードアクセスのために <button> を含むセマンティックな見出しタグ(H2-H4)を使用しなければなりません;WCAG 2.2 SC 2.5.8 の最小ターゲットサイズ(24x24px)を満たします。
  • レスポンシブ対応: アコーディオンの幅は流体(親要素の100%)でなければなりません。パネルコンテンツは完全にレスポンシブである必要があります。
  • 階層: アコーディオンのヘッダーは、ページのH1よりも視覚的に目立ってはいけません。

一般的な失敗パターン

  • ミステリーミートトリガー: アコーディオンのヘッダーがプレーンテキストのように見え、ユーザーがクリックできることに気づかない。
  • コンテンツの飛び跳ね: 速くてぎくしゃくしたトランジションがユーザーのスクロール位置を混乱させる。
  • フォーカス状態の欠落: キーボードユーザー向けの可視フォーカスリングの設計忘れ。
  • 過密パネル: パネル内に他のアコーディオンのような複雑なインタラクティブコンテンツを入れすぎて、「ネストされたインセプション」状態になる。
  • アクセス不能なARIA: aria-expanded 状態をプログラムで更新し忘れる。

検証基準

  • すべてのアコーディオン項目に明確な視覚的インジケーター(例:シェブロン)がある。
  • ヘッダーがキーボードでアクセス可能(ボタンベース)であり、可視フォーカス状態がある。
  • aria-expanded と aria-controls が正しく定義されている。
  • 内部のスペーシングが流体スペーシングシステムに従っている。
  • 排他的/複数開くロジックがコンテンツタイプに適切である。
  • アコーディオンがレイアウトを壊さずにスムーズに遷移する。
  • タッチターゲットがWCAG 2.2の最小24x24px(44x44px推奨)を満たしている。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for long-form content, managing readability, vertical rhythm, and information density to ensure a superior reading experience.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for informational elements that communicate state (Badges) and categorization (Tags) with clarity and accessibility.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for non-overlay notifications, managing global announcements and contextual inline alerts to communicate system states without interrupting the user's flow.

coastdigitalgroup/coastai-skills

Design and implement a systematic, asymmetrical bento-grid layout framework to organize diverse content types cohesively while maintaining strict visual hierarchy, logical focus order, and responsive flexibility.

coastdigitalgroup/coastai-skills

Design a responsive, mobile-first bottom navigation bar and persistent action dock system for mobile websites and web applications, establishing spatial anchors, tab bar anatomy, badge indicators, thumb-zone ergonomics, safe area inset handling, active/inactive state contrast, and desktop responsive adaptation rules.

coastdigitalgroup/coastai-skills

Design a mobile-first bottom sheet overlay system with configurable detents, drag affordances, safe area padding, responsive desktop modal/popover adaptation, and WCAG AA accessibility compliance.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for secondary navigation trails that provide orientation, context, and one-click access to parent levels in deep information architectures.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for buttons and interactive triggers, managing visual hierarchy, variant logic, and action grouping to ensure clear intent and accessible interaction.

coastdigitalgroup/coastai-skills

Design a systematic framework for date and time selection, managing calendar grids, range pickers, and scheduling interfaces to ensure precision and accessibility.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for modular content containers that maintain hierarchy, structural integrity, and action alignment across variable content and responsive viewports.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for horizontal discovery components, managing navigation affordances, scroll behavior, and accessibility to ensure effective content density without compromising usability.

coastdigitalgroup/coastai-skills

Design a systematic, highly accessible, and developer-friendly UI layout framework for code blocks, snippet showcases, multi-file code tabs, line-highlighting, diff views, and syntax token contrast in technical documentation and developer platforms.

coastdigitalgroup/coastai-skills

Design a systematic framework for global command menus (Cmd+K panels) that combines keyboard-driven navigation, command execution, and shortcut discovery into an accessible, responsive overlay.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for threaded conversations, managing nesting depths, action hierarchies, and community signaling to foster engagement and readability.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for side-by-side comparison interfaces, managing high attribute density and responsive complexity to support informed decision-making.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for user privacy, managing consent banners, preference centers, and persistent privacy controls to balance legal compliance with user trust.

coastdigitalgroup/coastai-skills

Design and implement a systematic, highly accessible, and responsive visual layout framework for conversational chat widgets, live chat boxes, and chatbot panels that ensures clear message scannability, native focus flow, and seamless mobile keyboard adaptation.

coastdigitalgroup/coastai-skills

Design a systematic, accessible, and high-conversion framework for custom select dropdowns and comboboxes, defining anatomy, states, search-filtering, and responsive mobile-adaptive patterns.

coastdigitalgroup/coastai-skills

Design and specify a systematic dark theme framework, establishing rules for elevation-based surface colors, desaturated brand accents, text legibility, and media adaptation to ensure an accessible, low-fatigue experience.

coastdigitalgroup/coastai-skills

Design and implement a systematic color palette that ensures WCAG 2.2 accessibility compliance. Trigger this skill when asked to define brand colors, create UI themes, or establish a visual system for a website.

関連スキル