AI摺疊面板生成器。

描述你的區段,MeDo即生成可摺疊面板——單開或多開行為、適配任何內容長度的高度動畫、自動展開指定面板的深層連結,以及用於複合式搜尋結果的FAQPage JSON-LD。

摺疊面板
摺疊面板

摺疊起來的面板,是在賭這段內容可有可無

摺疊面板通常是為了讓頁面看起來更短,但縮短頁面並非沒有代價。每個摺疊區段都是用可掃讀性換取資訊密度:本來會快速瀏覽六個答案的訪客,現在必須決定點開哪一個,而大多數人一個都不點。對於送貨政策、邊緣情況問題或冗長的規格表這類真正次要的內容,這筆交易值得;但對於真正能消除購買顧慮的那兩三個答案,這是一筆糟糕的交易。有效的做法是把購買意圖最高的內容從摺疊面板裡提出來放進正文,讓摺疊面板只承載長尾內容。這同時解決了同一問題的SEO一面:位於關閉面板中但存在於HTML裡的文字會被正常索引,而只在點擊後才注入的文字則可能不會。

6 個模板

可以產生的 摺疊面板 模板

每個模板都是真實的提示詞,而非截圖。複製到任何 AI 編輯器,或在 MeDo 中執行,直接取得 React + Tailwind 程式碼。

BasicFAQ Single-Open

Exclusive-Open FAQ List

One answer visible at a time, which keeps a long FAQ from turning into a wall once someone starts clicking. The default for landing-page questions.

Create an FAQ accordion with six items in single-open mode, where opening one item closes the currently open one. Each header is a full-width button carrying the question in 16px semibold text with a chevron on the right that rotates 180 degrees over 200ms; set aria-expanded on the button and aria-controls pointing at the panel, and give the panel role="region" with aria-labelledby back to the header id. Animate the panel with grid-template-rows from 0fr to 1fr so long answers never clip and short ones do not ease for the same duration. Enter and Space toggle, Tab moves between headers normally since each is its own tab stop, and a visible focus-visible ring is required. Allow the open item to be collapsed so no panel is forced open.

在 MeDo 中試試
ComparisonMulti-Open

Several Panels Open at Once

For troubleshooting steps and spec tables, where someone genuinely needs two sections side by side. Add Expand all only here — it is meaningless in exclusive mode.

Create a multi-open accordion where any number of panels may be expanded at once, holding open ids in a set rather than a single value. Add an Expand all and Collapse all control above the stack whose label reflects the current state, and make it a real button with aria-expanded describing the group. Each header is a button with aria-expanded and aria-controls; each panel is role="region" with aria-labelledby. Animate with grid-template-rows 0fr to 1fr so several simultaneous transitions do not fight a shared max-height. Preserve panel scroll position and any half-filled form fields by keeping panels in the DOM and toggling the hidden attribute rather than unmounting them. Enter and Space toggle the focused header.

在 MeDo 中試試
No JavaScriptNative Details

Details and Summary Accordion

Works before your bundle loads, is keyboard accessible with zero attributes, and joins find-in-page so a browser search opens the matching panel. The baseline to beat.

Create an accordion using native details and summary elements with no JavaScript at all. Give each details the same name attribute so the browser enforces exclusive-open behavior natively. Style the summary as a full-width row with 20px vertical padding, remove the default marker with list-style: none and ::-webkit-details-marker, and add a custom chevron that rotates using the details[open] selector. Animate the panel with interpolate-size: allow-keywords plus a height transition from 0 to auto, and add ::details-content to the transition so the reveal is smooth where supported and an instant open elsewhere. Keep a visible focus ring on the summary and ensure find-in-page still expands a closed panel.

在 MeDo 中試試
ShareableDeep Linked

Hash-Opened Panels With Copy Link

Every panel gets its own URL, so a support reply can point at one answer rather than "scroll down to the FAQ". The offset for the sticky header is the part that gets skipped.

Create an accordion where each item is addressable by URL hash. Give every header a stable slug id derived from its question, and on mount read location.hash, open the matching panel, and scroll it into view with scroll-margin-top of 96px so it does not land underneath a sticky header. Update the hash on open using history.replaceState so the back button is not filled with toggles, and listen for hashchange so in-page links work after the first render. Add a small copy-link button inside each header row that writes the absolute URL to the clipboard and swaps its label to Copied for two seconds; stop its click from bubbling to the header button so copying does not also collapse the panel.

在 MeDo 中試試
SEOFAQ Schema

Accordion With FAQPage JSON-LD

Panels and structured data generated from one array, which is the only way they stay in sync six months later. Treat the markup as a clarity signal, not a guaranteed rich result.

Create an FAQ accordion that renders both the interactive panels and a matching FAQPage JSON-LD script from the same array of question and answer objects, so the two cannot drift apart when someone edits a question. Emit the JSON-LD server-side in a script tag with type="application/ld+json", using Question and Answer entities with acceptedAnswer text. Render every answer into the HTML even while collapsed, hiding it with CSS rather than fetching it on click, since content injected after a click may never be crawled. Keep the accessible pattern intact: header buttons with aria-expanded and aria-controls, panels as role="region" with aria-labelledby, and a grid-template-rows height animation.

在 MeDo 中試試
NestedNested Groups

Grouped Accordion With Sub-Sections

Two levels for a long feature matrix or a knowledge base. Depth past two is where people lose the thread — if you need a third, the content wants its own page.

Create a nested accordion two levels deep: outer groups such as Security, Integrations and Support, each containing three to five child items. Indent child headers by 20px, drop their type size by one step, and keep every level as its own button with aria-expanded and aria-controls, panels as role="region" with aria-labelledby — do not use a treeview role, since these are disclosures, not a tree. Outer groups are multi-open and children are single-open within their parent. When a parent collapses, remember which children were open so reopening the parent restores that state rather than resetting it, and make sure the parent panel height animation accounts for children expanding after the parent has settled.

在 MeDo 中試試

如何自訂你的 摺疊面板

先決定用<details>還是按鈕

原生的<details>與<summary>組合零JavaScript即可運作,預設支援鍵盤操作,而且在瀏覽器頁內搜尋時會保持展開。帶aria-expanded的按鈕則讓你完全掌控動畫與互斥展開邏輯。請明確說明想要哪一種,因為兩者產生的標記完全不同。

切勿動畫至硬編碼的max-height

固定的max-height會裁切長答案,也會令短答案用同樣時長緩動。請要求以grid-template-rows由0fr過渡到1fr,或用interpolate-size配合calc-size實現height auto,讓過渡跟隨真實內容高度。

明確說明單開還是多開

互斥展開能令頁面保持簡短、讀者專注於一個答案。允許同時展開多項則更適合用戶需要比較區段或從兩個區段複製細節的情況。請說明預設行為,以及用戶能否把所有項目都收合——有些摺疊面板會一直保持一項展開。

把深層連結與捲動偏移一併提出

透過URL hash展開面板只是功能的一半。若沒有明確的捲動偏移,目標會落到置頂導覽列下方,所以請說明導覽列高度,並在同一段提示詞中要求scroll-margin-top或以腳本設定偏移。

誰在使用 摺疊面板 組件

行銷網站的FAQ區塊

在到達頁底部以互斥展開的摺疊面板放置八個問題,每項都支援深層連結,客服回覆可直接指向某一個答案,並由同一份資料陣列輸出FAQPage JSON-LD。

電商產品頁

把送貨、退換與保養說明摺疊在加入購物車按鈕下方,讓購買區保持在首屏,同時政策文字仍留在HTML中供搜尋引擎抓取。

文件或知識庫

把疑難排解步驟放進多開摺疊面板,讀者動手修復時可同時展開兩個相關區段對照閱讀。

定價頁比較

把冗長的功能比較表拆成保安、整合、支援等可摺疊分組,讓方案欄位始終可見,而不必捲過三屏表格列。

不同網站的 摺疊面板 方案

同一個 摺疊面板 組件,針對它所在網站的類型作調整。

01 / 06

Marketing Site FAQ

Exclusive-open questions at the bottom of a landing page, with the two or three answers that actually resolve a purchase objection promoted out into plain page copy above. An accordion holding your strongest answer is an accordion hiding it.

摺疊面板 的風格與變體

挑選與頁面其餘部分相襯的變體,然後產生它。

01 / 06

Divider List Accordion

Flush rows separated by 1px light-grey lines, with no outer border at all. The quietest option and the right one for an FAQ of ten or more items, where card borders and gaps would add more visual noise than structure.

在 React、Next.js、Vue 與 Svelte 中使用 摺疊面板

React、Next.js、Vue 3、SvelteKit、Astro 或純 HTML —— 同一個 摺疊面板,六種接入方式。

01 / 06

React Accordion

Hold open ids in a Set so the same component covers single and multi-open — swap the set for one id and you have exclusive mode. No height measurement is needed if the panel animates with grid rows.

src/components/Accordion.tsx

const [open, setOpen] = useState(new Set())

<button
  aria-expanded={open.has(item.id)}
  aria-controls={`panel-${item.id}`}
  onClick={() => toggle(item.id)}
>
  {item.question}
</button>
<div id={`panel-${item.id}`} role="region" className="grid"
     style={{ gridTemplateRows: open.has(item.id) ? '1fr' : '0fr' }}>
  <div className="overflow-hidden">{item.answer}</div>
</div>

如何把 摺疊面板 加入專案

四個步驟,從挑選 摺疊面板 模板到推上生產環境。

01~30s

Pick an Accordion Template

Decide two things first: single or multi-open, and native details versus a button with aria-expanded. Those choices produce different markup, so picking after generation means regenerating.

02~10s

Copy the Prompt

Take the prompt into MeDo, Lovable, Bolt, v0 or Cursor and paste your real questions and answers in place of the placeholders. If you want FAQPage JSON-LD, say so now so it is generated from the same array rather than hand-written later.

03~1min

Generate and Refine

You get React + Tailwind back with a live preview. Follow up in plain English — "allow several open at once", "open the panel matching the URL hash", "swap the chevron for a plus" — instead of editing the transition by hand.

04~2min

Check the Content and Ship

Before shipping, confirm the longest answer does not clip mid-animation, every answer is present in the HTML while collapsed, and your highest-intent copy is in open page text rather than behind a click.

關於 摺疊面板 的常見問題

如何用AI生成FAQ摺疊面板?

在提示詞中列出你的問題與答案,並說明同一時間可展開一個還是多個面板。MeDo會生成帶aria-expanded與aria-controls的無障礙標題按鈕、帶動畫的面板,並可選擇基於同一份內容生成配套的FAQPage JSON-LD,因此標記與結構化資料不會脫節。

該用<details>和<summary>還是自訂摺疊面板?

如果你想要可靠的基準,就用<details>和<summary>:它在JavaScript載入前就能運作,不加任何屬性也對鍵盤與螢幕閱讀器友好,並能參與瀏覽器的頁內尋找。當你需要互斥展開、可控的動畫曲線,或把狀態存放在URL裡時,改用帶aria-expanded的按鈕。現時瀏覽器已支援以interpolate-size過渡content-visibility與height,原生元素同樣可以做動畫。

如何把摺疊面板動畫至height auto?

把面板包在CSS grid裡,將grid-template-rows由0fr過渡到1fr,並為內層元素設定overflow hidden。這樣無須在JavaScript裡量度就能跟隨真實內容高度。在支援interpolate-size: allow-keywords的瀏覽器中,你可以直接把height由0過渡到auto,寫法更簡潔,值得作為漸進增強使用。

摺疊式FAQ能在Google取得複合式搜尋結果嗎?

可以,前提是頁面帶有有效的FAQPage結構化資料,而問答內容也出現在算繪後的HTML中。Google已把FAQ複合式結果的資格主要收窄至權威的政府與醫療健康網站,所以請把這套標記當作面向搜尋與AI答案引擎的清晰度訊號,而非有保證的SERP樣式。讓MeDo由算繪面板的同一個陣列生成JSON-LD,兩者便能一直同步。

把內容藏在摺疊面板裡會影響SEO嗎?

存在於HTML中但僅在視覺上摺疊的內容會被正常索引,Google也表示行動裝置上的摺疊面板是預期中的響應式模式。真正的風險是只在點擊時才載入答案,令它們可能未被抓取;以及把最重要的文案埋在沒人展開的地方。請把核心訊息放在展開的正文裡,用摺疊面板承載補充細節。

應該用摺疊面板還是分頁標籤?

當各區段彼此獨立、標籤文字長到讀起來像句子、或讀者可能想同時展開多個時,選擇摺疊面板——這正是FAQ清單幾乎總是用摺疊面板的原因。當各面板是被拿來比較的互斥選項(例如月費與年費定價),且標籤短到能排成一行時,選擇分頁標籤。問句形式的長標籤,是分頁標籤用錯模式最明顯的訊號。