<!-- GENERATED by scripts/build-llms.mjs from llms/retrieval.md — do not edit this file. -->

# `lr-grounding-summary`

- **Import** `import '@aceshooting/lyra-ui/components/lr-grounding-summary.js';` (stable tag alias; registers the tag)
- **Class** `LyraGroundingSummary`, also available unregistered from `@aceshooting/lyra-ui/components/retrieval/grounding-summary/grounding-summary.class.js`
- **Family** `components/retrieval/` — see `llms/index.md` for its siblings
- **Status** `stable` since `4.1.0` — see the maturity and deprecation policy in `llms/shared.md`
- **Release history** [CHANGELOG.md](../../CHANGELOG.md); family-wide breaking-change summaries: [llms-full.txt](../../llms-full.txt)
- **Deprecations** none
- **Optional peers** none
- **Themeable via** 16 parts, 0 custom properties — see this component's own `@csspart`/`@cssprop` list below
- **Library-wide behavior** (events, form association, `locale`/`strings`, tokens, TS types): `llms/shared.md`

---

## `lr-grounding-summary`

Claim-level grounding scorecard for one generated answer: supported/unsupported claim counts,
citation coverage, optional confidence, warnings, and evidence citations linking back to their exact
spans. Consumes `GroundingAssessment` from `@aceshooting/lyra-ui/ai` directly. Pure projection +
event conduit — never fetches or computes an assessment. Composes `lr-stat` for every numeric display
and `lr-citation-badge` for each evidence entry.

**Properties:**

- `assessment: GroundingAssessment | null = null` (attribute: false) — **`GroundingAssessment`,
  imported from `@aceshooting/lyra-ui/ai`**: `{ supportedClaims: number;
unsupportedClaims: number; coverage: number; confidence?: number; warnings?: string[];
claims?: GroundedClaim[] }`, where `coverage` and `confidence` are 0–1 fractions. `null` renders
  the empty state
- `citations: Citation[] = []` (attribute: false) — **`Citation` from `@aceshooting/lyra-ui/ai`**:
  `{ id: string; chunkId?: string; sourceId?: string; span?: { start: number; end: number };
label?: string }`. Independent of `assessment`; empty omits the whole evidence section. Each entry
  renders as an `lr-citation-badge` whose `index` is its 1-based position and whose `source-id` is
  `citation.sourceId ?? ''`
- `thresholds: LyraScoreThresholds = { high: 0.8, medium: 0.5 }` (attribute: false) —
  readonly `LyraScoreThresholds { high: number; medium: number }`, with both
  0–1 fractions,
  applied to both `coverage` and `confidence`: `>= high` → `success` tone, `>= medium` → `warning`,
  below → `danger`
- `label?: string` — fallback name for the stable group, using localized
  `groundingSummaryLabel` when omitted. A non-empty host `aria-label` makes the host the sole overall
  owner (the group omits its duplicate role/name); an explicitly empty host label stays empty
- `showClaims: boolean = true` (attribute `show-claims`) — renders `assessment.claims` through
  `lr-claim-evidence`; set false to keep the aggregate scorecard only
- `headingLevel: LyraHeadingLevel = '3'` (attribute `heading-level`) — shared semantic heading
  level used by both warnings and evidence sections; `'none'` keeps the visual text without
  exposing a heading role, and invalid untyped values fall back to level 3

Direct citations and `assessment.claims` are keyed independently by nonblank `id` before counts,
rendering, or events. Usable display fields are captured once while emitted selected claim/citation
objects retain their original identity. Malformed rows and later duplicate ids are omitted; the
first valid occurrence wins.

**Events:** `lr-citation-select` (`detail: CitationSelectEventDetail` from
`@aceshooting/lyra-ui/ai` = `{ citation: Citation }`) — emitted when an evidence badge is activated.
The inner `lr-citation-badge`'s generic activation is stopped at this composition boundary; this
richer event exists because a bare `sourceId`/`index` pair cannot identify the exact evidence span.
The summary emits `lr-claim-select` (`detail: { claim }`) when a claim is activated.

**Slots:** none.

**CSS parts:** `base` (the `role="group"` root unless a non-empty host label owns the component),
`stats` (the claim-count/coverage/confidence `lr-stat`
row), `warnings` (omitted when there are none), `warnings-heading`, `warnings-count`,
`warnings-list` (a `<ul>`), `warning` (one `<li>`), `evidence` (omitted when `citations` is empty),
`evidence-heading` (a real `h1`–`h6`), `evidence-count`, `evidence-list` (a `<ul role="list">` so
its semantics survive list-style resets),
`evidence-item` (one `<li>` containing a badge + always-visible label/span text),
`evidence-label` (omitted when `Citation.label` is unset), `evidence-span` (the formatted
`Citation.span` range, omitted when unset), `claims` (the claim/evidence region), `empty`
(shown when `assessment` is `null`).

**Themeable custom properties:** shared tokens only.

**Optional peer deps:** none.

---
