# Accordion

A list of headings that each open to show their content, for questions and answers.

This is the HTML to build it with `dex.css`, for work outside the Dex codebase. Read https://brand.meetdex.ai/design.md first: it says how to set up a page and how to use the stylesheet. The page at https://brand.meetdex.ai/components/accordion shows the Dex app's own React component, which only works inside the Dex codebase.

## HTML

Native `<details>` and `<summary>`, so it works with no script. Items that share a `name` keep one open at a time.

```html
<div>
  <details class="dex-accordion-item" name="faq" open>
    <summary>Who sees my profile?</summary>
    <div class="dex-accordion-panel">Only the teams you say yes to. Dex never sends your profile anywhere without asking.</div>
  </details>
  <details class="dex-accordion-item" name="faq">
    <summary>Does Dex cost anything?</summary>
    <div class="dex-accordion-panel">No. Companies pay Dex when they hire.</div>
  </details>
</div>
```

- **Open by default**: the `open` attribute on that item.
- **Multiple**: leave out `name`, so each item opens by itself.
- **Disabled item**: `dex.css` has no disabled state. Leave an item that can't open out of the list rather than drawing one.

## States

- The chevron turns when the item opens. Focus is the 75% edge inside the question row.
- Items sit on hairlines, with none under the last.

## Rules

- One item open at a time, and the open item can always be closed. Let several open only when a reader will want two answers side by side.
- Closed answers stay in the HTML, so a crawler that doesn't run JavaScript can still read them on public pages.
- Questions are short and in sentence case, ending with a question mark; answers are plain sentences.
