折叠面板
一组垂直堆叠的交互式标题,每个标题显示一部分内容。
What are your shipping options?
What is your return policy?
How can I contact customer support?
用途
Include JavaScript
复制或提供完整的 A3S UI JavaScript 包。
或者复制或提供 A3S UI 运行时和 Accordion 脚本。
使用CDN或批量程序导入?请参见安装页。
Add your accordion HTML
A3S UI uses native <details> and <summary> elements for disclosure semantics. The accordion JavaScript only enforces single-item behavior by default and prevents disabled items from toggling. Add data-multiple to the root when more than one item can be open at a time.
HTML 结构
<section class="accordion">Root accordion container. Add
data-multipleto allow multiple open items.<details open>Accordion item. Use the native
openattribute for the default expanded item. Addaria-disabled="true"when an item should not toggle.<summary>- Accordion trigger. Keep the trigger text visible and add an optional trailing icon.
<section>- Accordion content. Use any semantic element that fits your content.
JavaScript API
Accordion不公开自定义方法或事件。使用原生details.open布尔值以编程方式打开或关闭项目。
示例
基本
一次显示一个项目的基本折叠面板。第一项默认打开。
How do I reset my password?
Can I change my subscription plan?
What payment methods do you accept?
多个
使用data-multiple允许同时打开多个项目。
Notification Settings
Privacy & Security
Billing & Subscription
已禁用
在某个项目上使用 aria-disabled="true" 将其禁用。
Can I access my account history?
Premium feature information
How do I update my email address?
边框
使用带边框的根时,向行添加水平填充。
How does billing work?
Is my data secure?
What integrations do you support?
卡
将折叠面板包裹在卡片中以进行分组支持或计费内容。
Subscription & Billing
Common questions about your account, plans, payments and cancellations.
What subscription plans do you offer?
How does billing work?
How do I cancel my subscription?
RTL
折叠面板间距使用逻辑属性。在折叠面板或父元素上设置 dir="rtl"。