# Disclosure

Source: https://ecosphere.dev/docs/navigation/disclosure (Ecosphere 1.5). Install `vue-ecosphere` for Vue 3 or `react-ecosphere` for React 18.2+/19: same components, props, markup and stylesheet.

A section that shows its summary line and hides its detail until opened, on native details and summary — alone, or stacked in a bordered accordion.

`import { EcoDisclosure, EcoDisclosureGroup } from "vue-ecosphere"`

## Closed and open

Secondary detail most readers skip.

Vue (vue-ecosphere):

```vue
<EcoDisclosure v-model:open="open" title="Task timing and worker details">
  <dl class="kv"><dt>Task</dt><dd>T-58213</dd><dt>Attempts</dt><dd>1 of 3</dd>…</dl>
</EcoDisclosure>
```

React (react-ecosphere):

```tsx
<EcoDisclosure open={open} onOpenChange={setOpen} title="Task timing and worker details">
  <dl className="kv"><dt>Task</dt><dd>T-58213</dd><dt>Attempts</dt><dd>1 of 3</dd>…</dl>
</EcoDisclosure>
```

## With a count, and disabled-looking with the reason

Vue (vue-ecosphere):

```vue
<EcoDisclosure title="Details needing attention" :count="3" open>
  <ul><li>No signed date was found in the contract.</li>…</ul>
</EcoDisclosure>

<EcoDisclosure title="Extraction notes" :count="0" meta="None recorded" disabled />
```

React (react-ecosphere):

```tsx
<EcoDisclosure title="Details needing attention" count={3} defaultOpen>
  <ul><li>No signed date was found in the contract.</li>…</ul>
</EcoDisclosure>

<EcoDisclosure title="Extraction notes" count={0} meta="None recorded" disabled />
```

## Open, with a value and a table

Vue (vue-ecosphere):

```vue
<EcoDisclosure title="Invoice lines" :count="4" meta="Total 4,539.25" open>
  <div class="tablewrap"><table class="table table--compact">…</table></div>
</EcoDisclosure>
```

React (react-ecosphere):

```tsx
<EcoDisclosure title="Invoice lines" count={4} meta="Total 4,539.25" defaultOpen>
  <div className="tablewrap"><table className="table table--compact">…</table></div>
</EcoDisclosure>
```

## Accordion

Left: each opens on its own. Right: exclusive, one open at a time, for parallel answers such as FAQs.

Vue (vue-ecosphere):

```vue
<EcoDisclosureGroup>
  <EcoDisclosure title="Payment terms" open>…</EcoDisclosure>
  <EcoDisclosure title="Delivery" meta="Incoterms DAP">…</EcoDisclosure>
  <EcoDisclosure title="Price lists" :count="2">…</EcoDisclosure>
  <EcoDisclosure title="Amendments" meta="None yet" disabled />
</EcoDisclosureGroup>

<EcoDisclosureGroup exclusive>
  <EcoDisclosure title="What counts as a late delivery?" open>…</EcoDisclosure>
  <EcoDisclosure title="How are disputed invoices handled?">…</EcoDisclosure>
  <EcoDisclosure title="When does a new catalogue apply?">…</EcoDisclosure>
</EcoDisclosureGroup>
```

React (react-ecosphere):

```tsx
<EcoDisclosureGroup>
  <EcoDisclosure title="Payment terms" defaultOpen>…</EcoDisclosure>
  <EcoDisclosure title="Delivery" meta="Incoterms DAP">…</EcoDisclosure>
  <EcoDisclosure title="Price lists" count={2}>…</EcoDisclosure>
  <EcoDisclosure title="Amendments" meta="None yet" disabled />
</EcoDisclosureGroup>

<EcoDisclosureGroup exclusive>
  <EcoDisclosure title="What counts as a late delivery?" defaultOpen>…</EcoDisclosure>
  <EcoDisclosure title="How are disputed invoices handled?">…</EcoDisclosure>
  <EcoDisclosure title="When does a new catalogue apply?">…</EcoDisclosure>
</EcoDisclosureGroup>
```

## API

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `string` | — | One short line of plain text (#title slot). Never put a control inside the summary. |
| `v-model:open` | `boolean` | false | Open state, kept in step with the native details element. |
| `count` | `number \| string` | — | Small pill for how many items the body holds (disc__n). |
| `meta` | `string` | — | A figure or short fact at the end of the line (disc__m, #meta slot). |
| `disabled` | `boolean` | false | Disabled-looking: aria-disabled, toggle cancelled, meta becomes the described reason. Stays focusable. |
| `EcoDisclosureGroup exclusive` | `boolean` | false | The discs accordion; exclusive keeps one open at a time (details[name]). |
| `@toggle` | `(open: boolean) => void` | — | Opened or closed by the reader. |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `ReactNode` | — | One short line: text or a node. Never put a control inside the summary. |
| `open / defaultOpen / onOpenChange` | `boolean` | false | Open state, kept in step with the native details element. |
| `count` | `number \| string` | — | Small pill for how many items the body holds (disc__n). |
| `meta` | `ReactNode` | — | A figure or short fact at the end of the line (disc__m): text or a node. |
| `disabled` | `boolean` | false | Disabled-looking: aria-disabled, toggle cancelled, meta becomes the described reason. Stays focusable. |
| `EcoDisclosureGroup exclusive` | `boolean` | false | The discs accordion; exclusive keeps one open at a time (details[name]). |
| `onToggle` | `(open: boolean) => void` | — | Opened or closed by the reader. |
