# Disclosure row

A full-width row of a card that opens a panel under it, with an action beside its toggle.

Live variants: https://design.arcadia.is/components/disclosure-row

```tsx
import { DisclosureList, DisclosureRow } from "@arcadia/ui";
```

Open a plan to see when it resets. The row opens without moving its separate action.

```tsx
import { DisclosureList, DisclosureRow, Meter, Button } from "@arcadia/ui";

<div {...sx("cmp-disclosure-plans", s.plans)}>
  <DisclosureList rootStyle={s.tracks}>
    <DisclosureRow leading={<Who name="Weekly plan" />} detail={<span {...sx("cmp-disclosure-meter", s.meter)}><Meter value={52} /></span>}
      summary={<span {...sx("cmp-disclosure-value", s.value)}>52% left</span>}>
      <div {...sx("cmp-disclosure-panel", s.panel)}><span {...sx("cmp-disclosure-quiet", s.quiet)}>Resets Fri <time {...stylex.props(s.readout)}>11:48</time></span></div>
    </DisclosureRow>
    <DisclosureRow defaultOpen leading={<Who name="Daily plan" />} detail={<span {...sx("cmp-disclosure-meter", s.meter)}><Meter value={0} tone="danger" /></span>}
      summary={<span {...sx("cmp-disclosure-value", s.value, s.danger)}>Limit reached</span>} action={<Button size="sm" variant="ghost">Manage</Button>}>
      <div {...sx("cmp-disclosure-panel", s.panel)}><span {...stylex.props(s.quiet)}><span {...stylex.props(s.danger)}>Limit reached</span>. Resets in <span {...stylex.props(s.readout)}>3h 30m</span></span></div>
    </DisclosureRow>
    <DisclosureRow stack leading={<Who name="Signed out" />} summary={<span {...sx("cmp-disclosure-value", s.value)}>Sign-in expired</span>}
      action={<Button size="sm" variant="secondary">Sign in again</Button>}>
      <div {...sx("cmp-disclosure-panel", s.panel)}><span {...sx("cmp-disclosure-quiet", s.quiet)}>One account to sign in again</span></div>
    </DisclosureRow>
    <DisclosureRow stack leading={<Who name="Seven accounts" />} detail={<span {...sx("cmp-disclosure-meter", s.meter)}><Meter segments={POOL} /></span>}
      summary={<span {...sx("cmp-disclosure-value", s.value)}>2 of 7 open</span>} meta={<span {...sx("cmp-disclosure-quiet", s.quiet)}>1 back Wed <time {...stylex.props(s.readout)}>10:00</time></span>}
      openSummary={<><span {...sx("cmp-disclosure-value", s.value)}>2 of 7 open</span><span {...sx("cmp-disclosure-quiet", s.quiet)}>1 back Wed <time {...stylex.props(s.readout)}>10:00</time></span></>}
      openAction={<Button size="sm" variant="ghost">Manage</Button>}>
      <div {...sx("cmp-disclosure-panel", s.panel)}><span {...sx("cmp-disclosure-quiet", s.quiet)}>Seven accounts: two open now, one back Wed 10:00</span></div>
    </DisclosureRow>
  </DisclosureList>
</div>
```

## Accessibility

The toggle carries `aria-expanded` and `aria-controls`; its panel is a `region` named by it. Give the row a `label` when its content is not words enough (a meter is no sentence); a limit's row face names the toggle with the sentence it reads. The open action stays in the Tab order after the toggle, and shows when it takes focus. In a list, Up and Down move between rows, Home and End to the ends, Right opens and Left closes. Find in page reaches a closed panel's text and opens it.

## API reference

### DisclosureList

- `glide` (`boolean`, default `true`): One shared highlight gliding between rows. `false`: each row lights itself.
- `size` (`"card" | "md"`, default `"card"`): Its rows' height and inset: `card` 40, a card's; `md` 28, the kit's row in Body, as a menu's.
- `chevronOnHover` (`boolean`, default `false`): Quiet rows: each chevron stands only under the pointer, on keyboard focus in its row and while its row is open, and at rest where nothing can hover. It keeps its column, so nothing moves.
- `rootStyle` (`RootStyle<DisclosureKnobs>`): Typed StyleX override: where the list sits and its `--disclosure-*` knobs.
- `layout` (`DisclosureLayout`)

Rest props go to `<div>` props.

### DisclosureRow

- `layout` (`DisclosureLayout`)
- `open` (`boolean`): Controlled open state.
- `defaultOpen` (`boolean`, default `false`): Initial open state when uncontrolled.
- `onOpenChange` (`(open: boolean) => void`): Called when the toggle, an arrow key or a find-in-page match opens or closes it.
- `leading` (`ReactNode`): Who the row is: a mark and a name. It stays when the row opens. A row with a `face` has none.
- `face` (`ReactNode`): The row's face across the whole row, in place of `leading`, `detail`, `summary` and `meta`: a meter row for a limit that opens. The whole face is the toggle and what it opens stands under it; the chevron stands on its first line, and the end of that line gives way to the row's `action` and `openAction`.
- `detail` (`ReactNode`): What the row shows of itself after its name (a meter). Gives way while open; a stacked row puts it on its second line.
- `summary` (`ReactNode`): What the row says, at its end (a value, a state). Gives way while open.
- `meta` (`ReactNode`): Quiet text in the end cell (when it resets): inside the toggle. Gives way while open.
- `action` (`ReactNode`): One control in the end cell, beside the toggle and after it in tab order (never nested in it). With `openAction` it gives way while the row is open.
- `openAction` (`ReactNode`): An action at the row's end, beside the toggle: it shows under the pointer, on keyboard focus in the row and while the row is open (where nothing hovers, while it is open). While it shows, what it covers gives way (the summary, the meta where no `action` stands, a face's end) instead of standing under it; it stands before `action`, never on it.
- `openSummary` (`ReactNode`): What the row says before `openAction` while it shows, in place of the summary and meta it covers (a pool's count and its return). Words, not a control: a press on them reaches the toggle under them.
- `end` (`ReactNode`): A control in the chevron's place, beside the toggle.
- `holdSummary` (`boolean`, default `false`): The summary stays while open (a pool's count); a narrow list drops it.
- `label` (`string`): The toggle's accessible name, when its content is not words enough (a meter is no sentence).
- `stack` (`boolean`, default `false`): On a narrow list a row with a detail, a meta or an action stacks its parts: who it is and its chevron, its detail and its meta, what it says, then its action.
- `disabled` (`boolean`, default `false`)
- `keyshortcuts` (`string`)
- `children` (`ReactNode`): The panel: what the row summarised, in full. Find-in-page reaches it while closed, and opens it.

Rest props go to `<div>` props.
