# Citations

The numbered markers an answer gives its sources, and the Sources disclosure that lists each usable page once with its host.

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

```tsx
import {
  Citation, CitationList, citationHost, citationHref,
} from "@arcadia/ui";
```

```tsx
import { Bubble, Citation, CitationList } from "@arcadia/ui";

<div {...sx("citations-stack", page.stack)}>
  <Bubble>
    Each track takes its own share <Citation index={1} source={GRID} />, and a subgrid passes its
    parent&apos;s lines down <Citation index={3} source={SUBGRID} />. Both survive a narrow container
    <Citation index={4} source={EXAMPLES} />.
  </Bubble>
  <CitationList sources={CitationsSOURCES} defaultOpen />
</div>
```

## Accessibility

A marker is one link, named Source 1 followed by the page's title and host, so the number alone is never what a reader hears; a marker with no page still says those words, with no link. Keyboard focus opens the preview as the pointer does, Escape closes it, and Enter opens the page in its own tab without the opener, so the reply stays where it is. The list is a disclosure whose header says Sources and its count; each row is one link, named by its title and host. A page that is not an http or https address is plain text with no link and no place in the list.

## API reference

### Citation

- `index` (`number`, required): Its place in the answer, from 1; the same number marks its row in `CitationList`.
- `source` (`{ title: string; href: string }`, required): The page it cites.
- `rootStyle` (`RootStyle`): Typed StyleX override: where the marker sits.

### CitationList

- `sources` (`readonly CitationSource[]`, required): The sources, in the answer's order; each usable page is listed and counted once.
- `title` (`string`, default `"Sources"`): The disclosure's word. Or "Source" for one.
- `open` (`boolean`): Controlled open state.
- `defaultOpen` (`boolean`, default `false`): Open when it arrives.
- `onOpenChange` (`(open: boolean, details: OpenChangeDetails) => void`): Called when the header toggles it.
- `max` (`number`): Show this many rows, then a button for the rest.
- `rootStyle` (`RootStyle`): Typed StyleX override: where the disclosure sits.
