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

# `lr-knowledge-base-admin`

- **Import** `import '@aceshooting/lyra-ui/components/lr-knowledge-base-admin.js';` (stable tag alias; registers the tag)
- **Class** `LyraKnowledgeBaseAdmin`, also available unregistered from `@aceshooting/lyra-ui/components/retrieval/knowledge-base-admin/knowledge-base-admin.class.js`
- **Family** `components/retrieval/` — see `llms/index.md` for its siblings
- **Status** `stable` since `6.2.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** 6 parts, 2 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-knowledge-base-admin`

Tabbed operations shell composing `lr-knowledge-base` and `lr-ingestion-queue`. It forwards source
and ingestion actions under namespaced events; host-owned controls such as chunking, embedding,
permissions, and connector settings go in the `settings` slot.

**Properties:** `sources: KnowledgeSource[] = []` (attribute: false); `ingestionItems:
IngestionQueueItem[] = []` (attribute: false); `activeTab: 'sources' | 'ingestion' = 'sources'`;
`label?: string` (the visible heading and the tablist's distinct accessible name; omission uses the
localized admin label, while an explicit empty string stays empty; authored host
`aria-label` independently names the admin component and is not cloned onto either);
`hideIngestion: boolean = false`. If ingestion is active when it becomes hidden, `activeTab`
normalizes to `'sources'`, emits `lr-tab-change`, and moves focus to the Sources tab when needed.
An invalid runtime or authored `activeTab` value follows the same fallback instead of leaving every
tab and panel inactive.

**Events:** `lr-tab-change` (`{ tab }`, emitted only for a distinct accepted selection),
`lr-source-create`, `lr-source-sync`, `lr-source-pause`,
`lr-source-delete`, `lr-ingestion-retry`, and `lr-ingestion-cancel` (the latter four preserve the
correlated ids/details from their composed primitives).
`lr-activate` (`detail: { value: 'sources' | 'ingestion' }`, bubbling, composed, non-cancelable)
fires on **every** user activation of an available tab — a click, or an Arrow/Home/End key —
whether or not `activeTab` actually moved. `value` is the activated tab, the same identity
`lr-tab-change` reports under the key `tab`. It reports that the user picked a tab and gates
nothing. Use it for the repeat pick `lr-tab-change` deliberately stays silent for — "refresh that
queue" is a real intent — which from the keyboard is otherwise unobservable, because Home on an
already-first active tab (or End on an already-last one) activates a tab and produces no click at
all. When an activation _does_ move the tab, `lr-tab-change` is emitted first. The normalization
that moves an invalid or newly-hidden tab back to Sources is not a user activation and fires only
`lr-tab-change`.

**Slots:** `settings` — host-owned KB configuration controls.

**CSS parts:** `base`, `heading`, `tabs`, `tab`, `panel`, `settings`.

**Themeable custom properties:** `--lr-knowledge-base-admin-tab-selected-border` (default
`var(--lr-color-brand)`) and `--lr-knowledge-base-admin-tab-selected-color` (default
`var(--lr-color-text)`) — the bottom-border and text color of the selected `[part="tab"]`. State
hooks: inline `var()` fallbacks at the point of use rather than `:host` declarations, so either can
be set on the element _or on any ancestor_, and the rule wraps its `[aria-selected='true']` qualifier
in `:where()` so a consumer's own `::part(tab)` override still wins. They exist because
`::part(tab)[aria-selected='true']` is invalid CSS — Shadow Parts forbids an attribute selector after
`::part()`. Left unset, rendering is unchanged.

**Optional peer deps:** none.
