Communitygithub.com

coastdigitalgroup/coastai-skills

設計並實作系統化的非對稱便當盒網格佈局框架,以有條理地組織多樣化內容類型,同時維持嚴格的視覺層級、邏輯焦點順序與響應式彈性。

coastai-skills 是什麼?

「便當盒網格佈局系統」是一套專門用於組織異質內容的方法論,它從傳統日式便當盒汲取靈感,透過模組化網格將關鍵績效指標、視覺插圖、互動小工具、引言與產品功能預覽等元素整合成統一的佈局。此系統的核心價值在於解決儀表板、登陸頁與作品集常見的視覺碎片化問題,透過強制執行比例規則、一致的內部間距與結構化的字體縮放,將原本可能混亂的版面轉化為 polished、易於掃讀且具備無障礙親和性的視覺層級。支援的平台包括任何使用 CSS Grid 的現代前端框架,如 React、Vue、Svelte,或單純的 HTML/CSS 專案。其工作流程從定義底層 4 列網格幾何開始,依內容重要程度將單元格分類為主英雄、輔助與點綴三個層級,並制定嚴格的內部卡片解剖學規範,包含統一的 padding、彈性盒對齊模式與背景邊框處理。此外,系統特別強調 DOM 順序與視覺順序的一致性,以確保鍵盤與螢幕閱讀器的無障礙體驗,並明確規範從桌面 4 列、平板 2 列到手機 1 列的響應式折疊計畫。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/coastdigitalgroup/coastai-skills/tree/HEAD/website-design/bento-grid-layout-system

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

便當盒網格佈局系統

目的

便當盒網格佈局系統提供了一套方法論,用於將不同類型的內容(例如關鍵績效指標、視覺插圖、互動小工具、引言與產品功能預覽)組織成統一的模組化網格。此系統靈感源自傳統日式便當盒,在不同單元格高度與寬度之間建立起非對稱的平衡。它強制執行嚴格的比例規則、一致的內部內距與結構化的字體縮放,解決了儀表板、登陸頁與作品集上視覺破碎化的設計問題。此系統能將原本容易變得混亂的佈局,轉變為精緻、易於掃讀且具備無障礙親和性的視覺層級。

使用案例

  • SaaS 功能展示: 在單一登陸頁面區塊中,呈現產品功能、績效統計、系統整合與互動式 UI 預覽等多樣化的組合。
  • 資料與指標儀表板: 將關鍵績效指標、圖表與營運摘要分組至資訊密度高的視覺區塊中。
  • 作品集與案例研究: 以動態、非線性的方式展示創意作品、專案圖片、客戶引言與設計流程。
  • 電子商務系列: 以高衝擊力的編輯式佈局,突顯主打商品、限時系列、促銷橫幅與社交證明。

何時不該使用

  • 統一的內容列表: 如果頁面由重複的相同元素組成(例如標準部落格文章列表或商品網格),請使用 card-ui-system 或 responsive-grid-system。
  • 純層級式敘事: 對於依賴線性、順序性敘事的佈局(例如「步驟 1、步驟 2、步驟 3」),請使用 step-progress-system 或 section-composition-system。
  • 複雜的大量表格資料: 若使用者需要比較精確的技術數值或閱讀多列字母數字資料,請使用 data-table-ui-system。
  • 內容驅動的文章: 對於核心重點是不間斷、流暢文字的新聞版面,請使用 article-layout-system。

輸入

  1. 內容庫存與優先級: 要放置在便當盒網格中的項目清單,並依層級分類(1 個核心英雄、2-3 個輔助、2-4 個點綴)。
  2. 視覺資產分類: 每個單元格中的資產類型(靜態圖片、動畫插圖、互動滑桿、純文字、數值指標)。
  3. 目標欄數與斷點: 桌面欄位系統(通常為 4 欄主網格)、平板適應(通常為 2 欄)以及手機堆疊規則。
  4. 流體間距縮放: 用於間距與內部單元格佈局的流體 margin 與 padding token(來自 fluid-spacing-system)。
  5. 品牌設計 Token: 字體縮放、邊框圓角、邊框樣式、背景填色縮放與高度 token(來自 elevation-and-depth-system 與 fluid-typography-system)。

輸出

  1. 便當盒網格幾何圖: 一個比例座標藍圖,指定每個單元格的欄跨距(grid-column: span X)與列跨距(grid-row: span Y)。
  2. 內部卡片解剖規格: 針對不同單元格長寬比,訂定結構性間距、內容巢狀結構與對齊方式的規則。
  3. DOM 排序與無障礙地圖: 一個邏輯的頁籤順序,顯示 HTML 原始碼結構如何在不規則的視覺位置上維持無障礙性。
  4. 響應式堆疊計畫: 詳細的轉換規格,說明非對稱網格如何簡化為平板與手機螢幕。

工作流程

1. 建立網格幾何與欄位

首先定義底層的座標網格。

  • 主網格結構: 桌面佈局(1200px 以上)標準化為 4 欄 CSS 網格。這為單元格寬度提供了極佳的數學因子(1/4、2/4、3/4 或 4/4 寬度)。
  • 非對稱列高: 明確設定列的高度,或使用 grid-auto-rows: minmax(180px, auto) 來建立方形或水平矩形比例基礎(每單位長寬比 1:1 或 2:1)。
  • 流體間距: 使用流體間距 token 作為網格間隙(例如 gap: clamp(16px, 2vw, 24px)),使單元格在視覺上分離但緊密結合。

2. 依視覺層級映射與分配內容

不要隨機散佈項目。將每個單元格歸類為三個結構層級之一:

  • 核心英雄單元格(跨 2x2 或 3x2 軌道): 佔據網格區域約 40–50%。容納最重要的視覺資產、影片或指標。它決定整個區塊的視覺入口點。
  • 輔助單元格(跨 2x1 或 1x2 軌道): 突顯中間層級的功能或關鍵統計數據。它們比基本區塊更高或更寬,以便容納結構化文字與圖形。
  • 點綴單元格(跨 1x1 軌道): 保留給小型視覺元素、簡單的單值指標、圖示或徽章。它們填滿網格以維持矩形輪廓。

3. 設計便當盒單元格的內部結構

應用嚴格的內部間距限制以保持單元格的一致性:

  • 統一的內距: 在所有單元格中應用一致的內部內距,通常是一個流體內距 token(例如 padding: var(--space-m))。例外:點綴單元格(1x1)可以使用稍緊的內距(--space-s)。
  • 內部對齊模式: 在單元格內部使用 flexbox(display: flex; flex-direction: column; justify-content: space-between)將文字區塊垂直對齊到頂部,並將視覺重點(指標、圖形)對齊到底部。
  • 背景與邊框: 在所有單元格中標準化統一的邊框圓角(例如 border-radius: 16px 至 24px)。使用微妙的背景填色(例如中性色調、半透明玻璃擬態背景或低對比度卡片表面)來建立清晰的卡片邊界。

4. 為鍵盤與螢幕閱讀器無障礙性組織 DOM 順序

不規則的網格佈局可能導致視覺閱讀順序與實際 DOM 順序不匹配。

  • 自然閱讀流程: 按照邏輯從左到右、從上到下的順序排列 HTML 文件中的元素,如同讀者閱讀一般。
  • 避免修改順序: 永遠不要在 CSS 中使用 order 或以跳過可聚焦元素的方式任意定位單元格。如果單元格 1 位於左上角,單元格 2 位於右上角,則它們必須以該順序出現在 DOM 中,即使 CSS Grid 佈局以不同方式跨列。
  • 語義標題: 為每個內容豐富的單元格提供一個清晰、具描述性的標題標籤(通常為 <h3> 或 <h4>),並與父區塊 <h2> 的大綱匹配。

5. 定義響應式堆疊與斷點

確保網格優雅地處理視口縮放:

  • 桌面(1200px 以上): 4 欄佈局。非對稱的欄與列跨距。
  • 平板(768px - 1199px): 切換為 2 欄網格。重新映射跨距,使原為 1x1 的單元格跨 1 欄,原為 2x1 的單元格跨兩欄(2 欄全寬)。
  • 手機(767px 以下): 將網格完全折疊為 1 欄垂直堆疊(grid-template-columns: 1fr)。移除明確的列高(grid-auto-rows: auto),讓元素自然流動,高度由內部內距與內容大小決定。

決策規則

何時跨欄 vs. 跨列

項目內容類型跨距決策規則建議的桌面幾何
高衝擊力指標 / 主要功能同時跨欄與跨列以建立焦點中心。grid-column: span 2; grid-row: span 2;
寬幅視覺 / 時間軸 / 圖表水平跨欄;高度維持 1 列,以引導視線水平移動。grid-column: span 2; grid-row: span 1;
長文字列表 / 高圖片垂直跨列;寬度維持 1 欄,以引導視線向下移動。grid-column: span 1; grid-row: span 2;
單一指標 / 徽章 / 圖示不跨距。維持標準的方形區塊。grid-column: span 1; grid-row: span 1;

便當盒單元格中的字體縮放

  • 適應性大小: 不要對所有卡片使用相同的字體大小。保持字體縮放與卡片大小成比例。
  • 英雄卡片: 標題使用 font-size: clamp(1.5rem, 4cqi, 2.25rem)(若支援容器查詢單位 cqi)。
  • 點綴卡片(1x1): 標題限制為 font-size: clamp(1rem, 2.5cqi, 1.25rem),並保持描述簡短(最多 2 行),或完全省略描述,僅使用圖示 + 指標。

內容包含 vs. 出血

  • 包含式佈局: 將內容完全置於卡片內距之內,文字與邊框之間至少有 16px 的呼吸空間。最適合文字密集的資訊型卡片。
  • 出血式佈局: 讓視覺元素(產品截圖、詳細的 3D 模型、複雜圖表)溢出到卡片底部和/或右側邊緣,並遮罩溢出(在單元格上設定 overflow: hidden)。文字保持內距並在頂部可讀。用於核心英雄與輔助視覺卡片。

限制

  • 焦點可見性(WCAG 2.2 SC 2.4.11 / 2.4.13): 如果任何單元格是可聚焦的(例如作為大型連結卡片),它必須有一個明確、高對比度的 :focus-visible 輪廓。焦點指示器絕不能被父層網格容器或卡片邊界裁剪。
  • 觸控目標(WCAG 2.2 SC 2.5.8): 便當盒單元格內的所有互動元素(按鈕、展開切換、滑桿)必須有最小 24x24px 的目標大小,並有足夠的周圍間距,針對手機觸發器則偏好 44x44px。
  • 閱讀順序對齊(WCAG 2.1 SC 1.3.2): 螢幕閱讀器解析的內容順序必須與便當盒網格的語義意義和視覺順序相匹配。左上角的單元格在原始 DOM 中必須始終出現在右下角單元格之前。
  • 對比度(WCAG AA): 便當盒卡片內的所有文字必須與卡片背景達到至少 4.5:1 的對比度。避免在色調卡片內的描述中使用低對比度的細微灰色。

常見失敗模式

  • 「視覺雜物抽屜」效應: 僅僅因為元素適合就把它們塞進便當盒網格。每個單元格必須為父頁面服務一個連貫的敘事目的。
  • DOM 與視覺斷連: 卡片在視覺上以一種順序排列,但在 HTML 中卻以完全不同的順序存在。螢幕閱讀器和鍵盤頁籤導航在網格中混亂地跳躍。
  • 手機佈局爆炸: 在手機螢幕上保留硬編碼的欄跨距,強迫卡片縮小,導致文字溢出且完全無法閱讀。
  • 過大的邊框圓角衝突: 在卡片上使用巨大的邊框圓角,同時保持微小、銳利的邊距,或巢狀內部元素的邊框圓角與外部卡片的同心圓曲線不匹配。
  • 缺乏焦點錨點: 建立一個所有單元格大小完全相同的網格(例如全部是 1x1 或全部是 2x1),消除了佈局的入口點並導致掃讀疲勞。

驗證標準

  • 統一的幾何: 網格使用底層、一致的座標框架(桌面理想上為 4 欄佈局),並帶有統一的間距。
  • 清晰的層級: 單一「英雄」區塊在視覺上佔主導地位,並建立清晰的佈局入口點。
  • 自然的頁籤順序: 透過網格元素的頁籤瀏覽應可預測地從左到右、從上到下移動,與視覺佈局相符。
  • 手機可堆疊性: 佈局在手機視口(< 768px)上能乾淨地轉變為單欄堆疊,且無水平溢出。
  • 內部間距一致性: 所有相似卡片的單元格內距相同,元素具有統一的垂直對齊。
  • 對比度 AA 合規: 每張卡片內所有文字區塊和狀態指示器的對比度至少達到 4.5:1 的 WCAG AA 標準。
  • 互動安全性: 便當盒卡片內所有小工具的點擊目標滿足 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 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.

相關技能