Collapsible
Shows or hides a block of content with a height transition. Unlike the Accordion, it’s independent—a single section, with no coordination with others. The trigger can be customized.
Content · TaishoDS Core, in plain HTML.
Examples
One working example per case. Each example is the HTML of its preview—copy it as is, and with Core’s CSS and JS loaded, it looks and works the same.
Deployment details
Deployment details
Built in 2 min 14 s from the main branch.
When to use
- There’s a secondary detail most people don’t need to see, like advanced options or a log.
- It’s a single section with no siblings to coordinate with.
- You want to control whether it’s open from outside. Change the trigger’s
aria-expanded.
When not to use
- It’s several sibling sections read one at a time →
accordion. - The content is contextual and floating →
popover.
Do
- Make the trigger say what it will reveal, not just “Show more.”
- Leave it open by default if the content matters in most cases.
Don’t
- Don’t hide an error or anything that requires action in it.
- Don’t use it for a list of sections. That’s what
accordionis for.
TaishoDS Core
Needs Core’s JS, which hooks in through data-ts-* attributes.
It’s a <details> with its <summary>, so it opens and closes without JavaScript. Core only adds the event and opening from code.
Core hooks into it through these attributes. They go in the markup, and there’s nothing to initialize.
data-ts-accordiondata-ts-accordion-itemdata-ts-accordion-triggerdata-ts-value
What it does: Without JavaScript it opens and closes on its own, by click and with Enter or Space. With Core it fires a cancelable ts:change. To open it from code, change the <details> open property, as in Accordion.
From the CDN, without a build, load taisho.collapsible.css along with taisho.base.css. Also load:
taisho.icon.css
For how Core works in general, see Behavior.
Accessibility
Implements the Disclosure pattern from the WAI-ARIA APG.
- It’s a
<details>with its<summary>. The browser exposes it as an expandable button and publishes the state, with noaria-expandedof its own. It opens and closes with Enter/Space even when JavaScript doesn’t load.
Keyboard
On top of what the browser already does (Tab moves focus, Enter activates a button).
| Key | What it does |
|---|---|
| Enter/Space | Toggles the content. |
Verification
What was actually tested. Anything that wasn’t tested says so—we’d rather say “not verified” than claim too much.
- axe WCAG 2.2 A + AA in a real browser, in light and dark mode, before every release.
- keyboard Key map documented above, checked against the component.
- screen reader Not verified with a screen reader. Test it in your own combination of components, not just here, where each one appears alone and on its happy path.