Communitygithub.com

レスポンシブグリッドシステム

デバイス間でスケールする、柔軟なカラムベースのレイアウトシステムを設計・実装します。ページレイアウトの構築、UIコンポーネントの設計、ウェブサイトのレスポンシブ動作の確立を求められたときにこのスキルを起動します。

レスポンシブグリッドシステム とは?

このスキルは、レスポンシブグリッドシステムを設計・実装するための体系的なガイドを提供します。カラム、ガター、マージンを一貫して使用することで、視覚的な配置を保証し、階層を維持し、モバイル、タブレット、デスクトップの各画面サイズ間でのデザイン移行を簡素化します。ブレークポイントの定義、カラム数とガター幅の設定、CSS GridやFlexboxを用いた実装ロジックの生成、サブグリッドやコンテナクエリなどの高度な手法までを網羅しています。アクセシビリティ(WCAG 2.2準拠)や一貫性、モバイルファースト設計といった制約も考慮しており、結果として保守性が高く、スケーラブルなレイアウトシステムを構築できます。主にウェブサイトやアプリケーションの構造設計、UIキットの構築、データ表示インターフェースの整理などに活用されます。

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

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

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

ドキュメント

レスポンシブグリッドシステム は何をしますか?

目的

レスポンシブグリッドシステムスキルは、ウェブページ上のコンテンツを整理するための構造化された基盤を提供します。一貫したカラム、ガター、マージンを使用することで、視覚的な配置を保証し、階層を維持し、異なる画面サイズ(モバイル、タブレット、デスクトップ)間でのデザイン移行を簡素化します。

ユースケース

  • 新しいウェブサイトやアプリケーションの構造レイアウトを設計する。
  • UIキットやデザインシステムのコンポーネントライブラリを構築する。
  • ダッシュボードやデータ量の多いインターフェースなどの複雑なコンテンツを整理する。
  • 複数ページにわたって一貫した垂直リズムと水平方向の配置を確保する。

使用すべきでない場合

  • 実験的/ブルータリズムデザイン: 視覚的な目標が、芸術的な効果のために標準的なレイアウトの慣習を意図的に破ることである場合。
  • 単一目的のシンプルなページ: コンテンツが非常に少ない(例:中央揃えのフォームのみ)場合、完全なグリッドシステムは不要なオーバーヘッドを追加します。
  • 固定幅環境: 出力が厳密に非レスポンシブな媒体向けである場合(ただし、配置にはグリッドが依然として有用です)。

入力

レスポンシブグリッドシステムを確立するには、以下が必要です:

  1. デバイスのブレークポイント: レイアウトが変更される画面幅(例:600px、900px、1200px)。
  2. カラム数: 各ブレークポイントでのコンテンツ用の垂直トラックの数(標準:デスクトップ12、モバイル4)。
  3. ガター幅: カラム間のスペース(例:16px、24px)。
  4. 外側マージン: ビューポートの左右端のパディング(例:モバイルで20px、デスクトップで5%または固定最大幅)。
  5. コンテンツ要件: コンポーネントのリストとその相対的な優先順位/サイズ。

出力

  1. グリッド仕様: 主要なブレークポイントごとのカラム、ガター、マージンの定義。
  2. レイアウトマップ: コンポーネントが異なるサイズでどのようにカラムにまたがるかを示す視覚的または説明ガイド。
  3. 実装ロジック: システムを実現するためのCSS(GridまたはFlexbox)プロパティ。

ワークフロー

1. ブレークポイントの定義

レイアウトを適応させる必要がある主要な画面幅を選択します。 一般的なスケール:

  • モバイル: 0 - 599px
  • タブレット: 600px - 899px
  • デスクトップ: 900px以上(最大幅コンテナは約1200px~1440px)

2. カラムとガターのパラメータ設定

グリッドの「内部ロジック」を決定します。

  • モバイル: 4カラム、16pxガター、16pxマージン。
  • タブレット: 8カラム、24pxガター、32pxマージン。
  • デスクトップ: 12カラム、24pxガター、自動マージン(中央揃えコンテナ)。

3. コンテナの動作を確立する

グリッドがFluid(ビューポートのパーセンテージとして拡大縮小)、Fixed(次のブレークポイントまで特定の幅を維持)、またはAdaptive(混合)のいずれであるかを決定します。推奨: max-width を固定したFluidグリッドを使用し、clamp()(例:max-width: clamp(320px, 90vw, 1440px))でサイズ設定すると、コンテナがブレークポイントでジャンプするのではなくスムーズに拡大縮小します。

4. コンテンツをグリッドにマッピングする

CSS Grid(grid-template-columns: repeat(12, 1fr) と grid-column: span N)を使用して、コンポーネントを特定のカラム数に割り当てます(floatやinline-blockのハックは使用しないでください)。 例: サイドバーはデスクトップ(12カラムグリッド)で3カラムにまたがり、メインコンテンツは9カラムにまたがる場合があります。モバイルでは、両方とも4カラムすべてにまたがります(積み重なり)。

グリッドセル内にネストされたコンポーネントで、親グリッドのトラックに配置する必要がある場合(例:カードの内部ヘッダー/ボディ/フッターを兄弟カードと揃える場合)、新しい独立したグリッドを再宣言するのではなく、subgrid(grid-template-columns: subgrid または grid-template-rows: subgrid)を使用します。

コンポーネントの内部レイアウトがビューポートではなく、自身の利用可能なスペースに依存する場合(例:画面ではなくコンテナの幅に基づいて1カラムから2カラムに折り返す必要があるカード)、メディアクエリではなくコンテナクエリ(ラッパーに container-type: inline-size、子に @container (min-width: …))を使用します。

5. スタッキングと順序を定義する

画面が小さくなったときに要素がどのように移動するかを決定します。通常、左側の要素は右側の要素の上に積み重なります。グリッドのガターとマージンには論理プロパティ(margin-inline、padding-block)を使用して、システムが個別のオーバーライドなしでRTLレイアウトに自動的に適応するようにします。

決定ルール

  • 12カラムルール: デスクトップでは12カラムグリッドを使用します。これは2、3、4、6で割り切れるため、最大の柔軟性を提供します。
  • 一貫性: 配置を維持するために、単一のブレークポイント全体で同じガター幅を使用します。
  • モバイルファースト: 常に4カラムのモバイルレイアウトを最初に設計して、コアコンテンツが優先されるようにします。
  • 「安全地帯」: モバイルデバイスでコンテンツが画面の端に触れないように、外側マージンが十分に大きいことを確認します。
  • ビューポート vs. コンテナ: ページ全体のビューポート駆動型レイアウトシフト(例:全体的なカラム数)にはメディアクエリを使用します。コンポーネントがビューポートに関係なく自身のボックスサイズに適応する必要がある場合(例:サイドバーと全幅セクションで同じカードコンポーネントが異なる折り返し方をする場合)は、コンテナクエリを使用します。

制約

  • アクセシビリティ: カラムが縮小してもテキストが判読可能であり、タップターゲット(ボタン)が十分な大きさを保つことを確認します — WCAG 2.2(2.5.8)は24x24pxの絶対最小値を、主要な操作には44x44pxを推奨しています。
  • レスポンシブ性: モバイルビューポート幅を超える固定ピクセル幅の要素があってはなりません(水平スクロールを避ける)。
  • 階層: グリッドを使用して重要度を強化します。より重要な要素は通常、より多くのカラムにまたがるか、スタックの上位に表示されます。

よくある失敗パターン

  • ガターの不統一: 異なるカラム間で異なる間隔を使用し、視覚的な「ライン」を壊してしまう。
  • ガターレスデザイン: コンテンツを(画像などの意図的な場合を除いて)余白なしで互いに隣接して配置する。
  • 過度な複雑さ: 微調整のためにブレークポイントを作成しすぎて、メンテナンス不可能なCSSになる。
  • 「中間」の無視: 320pxと1440pxだけでテストし、800pxや1024pxでのレイアウトの見え方を無視する。

検証基準

  • コンテンツがグリッドの垂直ラインに完全に配置されている。
  • 320pxから2560pxまでのすべてのビューポート幅で水平スクロールバーが表示されない。
  • ブレークポイント間の移行が論理的であり、コンテンツが読みやすいままである。
  • ガターとマージンがページ全体で一貫している。
  • システムがカラム幅にハードコードされたピクセルではなく、相対単位(%、fr、rem)を使用して実装されている。
  • コンテナクエリが(ビューポートメディアクエリの代わりに)レイアウトが自身のボックスサイズに依存するコンポーネントに使用されている。
  • タップターゲットが少なくともWCAG 2.2の24x24pxの最小値を満たしている。

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 progressive disclosure using accordions, ensuring structural integrity, visual affordances, and accessibility across different content densities and devices.

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 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.

関連スキル