When to use
- A long answer with a short version: lead with the summary, and keep the detail one click away.
- Supporting detail most readers can skip, such as methodology, background or a longer explanation.
- Bios and descriptions in cards or columns, where the full text would make neighbouring items uneven.
For several titled sections a reader chooses between, use an Accordion. For text every reader must see, such as safety or legal information, don't hide it behind a link: use Text, or the ISI for safety information.
Key decisions
- Collapsed Content is always visible. The expand link is added to the end of its last paragraph, so end it on a sentence that makes the reader want the rest.
- Expanded Content opens below it, and the collapse link is added to the end of its last paragraph.
- Labels default to "Read more" and "Read less". Where you can, say what the reader gets, such as "How it loads".
- Icon Style adds a plus/minus or caret after both labels.
- Accessibility is built in: both links are buttons that announce whether the text is open, and hidden text can't be reached by keyboard until it opens.
Examples
Default labels
Only the two content fields are set. The labels fall back to "Read more" and "Read less", with no icon.
RHEA is a library of blocks for AEM Edge Delivery Services, built once and used by many sites.
Repoless sites read their code straight from the RHEA repository, so they get each release as soon as it ships. Projects created from the RHEA template start with their own copy of the blocks, and take later fixes one at a time, when they choose to.
Custom labels with a plus / minus icon
Expand Link Label is "How it loads", Collapse Link Label is "Show less", and Icon Style is Plus / Minus.
Centered, small text with a caret
Text Alignment is Center, Font Size is Small and Icon Style is Caret.
All authoring options
| Tab | Field | Name | Values |
|---|---|---|---|
| General | ID | id | Text |
| General | Collapsed Content | collapsedContent | Rich text |
| General | Expanded Content | expandedContent | Rich text |
| General | Expand Link Label | expandLabel | Text |
| General | Collapse Link Label | collapseLabel | Text |
| Appearance | Text Alignment | classes | Left, Center, Right |
| Appearance | Icon Style | classes_iconStyle | None, Plus / Minus, Caret |
| Appearance | Font Size | classes_fontSize | Default, Small, Caption, Small Caption |
| Appearance | Text Color | classes_textColor | Default, Inverse, Primary, Secondary, Brand Primary, Brand Secondary |
| Analytics | Track Inview | classes_track-inview | On / off |
| Analytics | Track Expand/Collapse Click | classes_track-toggle | On / off |
| Analytics | Track Collapsed Content Link Click | classes_track-collapsed-link-click | On / off |
| Analytics | Collapsed Content Link Meta | collapsedLinkMeta | Text |
| Analytics | Track Expanded Content Link Click | classes_track-expanded-link-click | On / off |
| Analytics | Expanded Content Link Meta | expandedLinkMeta | Text |
| Analytics | Events/Analytics Meta | meta | Text |
Each analytics toggle adds a class and creates no row. Link meta fields take one JSON object per link, in order; use a hyphen (-) to skip a link. Events emitted:
emu-collapsible-text:inview
emu-collapsible-text:toggle
emu-collapsible-text:inner-link:click