跳到正文
cccskills
免费在 GitHub 公开

expandable-text

Use when implementing show or hide additional text content on demand.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(2)

  • SKILL.md3.2 KB
  • references/pattern.md16.4 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Expandable Text

Show or hide additional text content on demand

What it solves

Expandable Text is a content management pattern that allows users to expand and collapse sections of text. This pattern improves readability by initially hiding non-essential content while keeping it accessible on demand. Expandable Text is commonly used to manage lengthy descriptions, article summaries, or additional details that are helpful but not immediately necessary. It helps users scan content efficiently while maintaining a clean and minimal interface.

When to use

Use Expandable Text when you need to manage lengthy content while keeping essential information visible. Common scenarios include:

  • Summarizing content – Showing a short preview of a longer article, product description, or FAQ answer.
  • Reducing page clutter – Keeping the interface clean by hiding secondary details.
  • Improving mobile usability – Managing screen space efficiently on smaller devices.
  • Progressive disclosure – Revealing additional information only when needed.
  • Enhancing readability – Preventing information overload while keeping details accessible.

When to avoid

  • For critical information – Users should not need to expand content to access essential details, such as pricing, terms, or important warnings.
  • For frequently accessed content – If most users expand the content, it may be better to display it by default.
  • When full content is needed upfront – Avoid hiding information that helps users make informed decisions quickly.

Implementation workflow

  1. Confirm the pattern matches the problem and constraints before copying the example.
  2. Start from the anatomy and examples in references/pattern.md, then choose the smallest viable variation.
  3. Apply accessibility, performance, and interaction guardrails before layering visual polish.
  4. Use the testing guidance to verify behavior across keyboard, screen reader, responsive, and failure scenarios.

Accessibility guardrails

ARIA Attributes

Required ARIA attributes:

  • aria-expanded="false" on the button (updated dynamically).
  • aria-controls="id-of-content" to link the button to the expandable content.
  • hidden attribute on the expandable content when collapsed.

Screen Reader Support

  • Ensure that the expanded content is properly announced by screen readers.
  • Use aria-live="polite" if the content update needs to be announced.

Related patterns


For full implementation detail, examples, and testing notes, see references/pattern.md.

Pattern page: https://uxpatterns.dev/patterns/content-management/expandable-text

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

accordion

免费

Use when implementing expand and collapse content sections.

中文简介正在准备中。当前显示原文说明。

thedaviddias/ux-patterns-for-developers2662026年10月5日 更新

Use when implementing user account configuration and preferences.

中文简介正在准备中。当前显示原文说明。

thedaviddias/ux-patterns-for-developers2662026年10月5日 更新

Use when implementing social activity and updates stream.

中文简介正在准备中。当前显示原文说明。

thedaviddias/ux-patterns-for-developers2662026年10月5日 更新

ai-chat

免费

Use when implementing conversational AI chat interfaces.

中文简介正在准备中。当前显示原文说明。

thedaviddias/ux-patterns-for-developers2662026年10月5日 更新

Use when implementing handling AI-specific errors.

中文简介正在准备中。当前显示原文说明。

thedaviddias/ux-patterns-for-developers2662026年10月5日 更新

Use when implementing loading states for AI operations.

中文简介正在准备中。当前显示原文说明。

thedaviddias/ux-patterns-for-developers2662026年10月5日 更新

查看 thedaviddias 的全部技能

报告此技能的问题