# Unfold

The kit's one fold: a block that unfolds to its content's height and folds back to none, its chevron turning with it.

Live variants: https://design.arcadia.is/components/unfold

```tsx
import { Unfold } from "@arcadia/ui";
```

```tsx
import { useState } from "react";
import { Button, Unfold } from "@arcadia/ui";

function Pinned() {
  const [open, setOpen] = useState(true);
  return (
    <div data-demo="unfold" {...sx("cmp-unfold-stage", UnfoldStyles.stage)}>
      <div {...sx("cmp-bar", cmp.bar, UnfoldStyles.folding, open && UnfoldStyles.turned)}>
        <Button variant="secondary" size="sm" iconEnd="chevron-right" aria-expanded={open} onClick={() => setOpen(!open)}>Pinned</Button>
      </div>
      <Unfold open={open}><Tiles /></Unfold>
      <span {...sx("cmp-unfold-below", UnfoldStyles.below)}>What follows moves with it</span>
    </div>
  );
}
```

## Accessibility

While folded or folding the content is `inert` and hidden from assistive tech, so Tab never lands inside a block of zero height; kept mounted, it is `hidden="until-found"` instead. Reduced motion snaps between the two heights and keeps the short fade; the transition still ends, so anything waiting on it runs.

## API reference

### Unfold

- `open` (`boolean`, required): Shown at its full height, or folded to none. Changing it eases the height between the two.
- `keepMounted` (`boolean`): Keep it mounted while folded, as `hidden="until-found"`: find in page reaches it and calls `onFound`.
- `onFound` (`() => void`): A find-in-page match inside: open it (at once).
- `instant` (`boolean`): This change snaps (hydration, bulk, a jump), as every change under `data-instant` does.
- `clip` (`boolean`): false: unclipped while open (for one that only closes at once).
- `rootStyle` (`RootStyle`): Typed StyleX override: where it sits.
- `children` (`ReactNode`): What unfolds: drawn while the fold closes over it, then unmounted.

Rest props go to `HTMLAttributes<HTMLDivElement>`.
