kai-sources
Gives a reply its references as tappable chips instead of a wall of links.
- Shadow DOM
- No events
- Optional favicons
- Numbered or domain labels
- Declarative children
Preview
Section titled “Preview”Assign the sources property — an array can’t be an HTML attribute:
<kai-sources id="srcs" show-favicon></kai-sources><script type="module"> import '@kitn.ai/ui/web-components'; document.getElementById('srcs').sources = [ { href: 'https://kitn.dev', title: 'kitn — the kit', description: 'Composable chat UI.' }, { href: 'https://solidjs.com', title: 'SolidJS', description: 'A reactive UI library.' }, ];</script>- Each item accepts
href(required),title,description,label, andshowFavicon. show-faviconenables favicons globally; a per-itemshowFavicon: falseoverrides for that chip.numberedreplaces domain labels with[1],[2], …- Declarative path:
<kai-source>elements as light-DOM children, appended after any prop sources. Attributes arehref,label,headline,description, and the bareshow-favicon: the item’stitlefield is spelledheadline, becausetitleis a reserved global HTML attribute.
<kai-sources> <kai-source href="https://kitn.ai" headline="AI/UI" description="Web components for AI chat"></kai-source></kai-sources>| Child element | Attributes | Text content | Notes |
|---|---|---|---|
| <kai-source> | descriptionheadlinehreflabelshow-favicon | — | Parse a single light-DOM `<kai-source>` element into a `KaiSourceItem` descriptor. Attribute mapping: - `href` → KaiSourceItem.href - `label` → KaiSourceItem.label - `headline` → KaiSourceItem.title (matches kai-source's prop name; "title" is a reserved HTMLElement attribute so kai-source uses "headline") - `description` → KaiSourceItem.description - `show-favicon`→ KaiSourceItem.showFavicon (bare boolean attribute) |
Examples
Section titled “Examples”Default with Favicons
Section titled “Default with Favicons”Domain Labels Only
Section titled “Domain Labels Only”Numbered Citations
Section titled “Numbered Citations”| Property | Type | Default | Notes |
|---|---|---|---|
| theme | "light" | "dark" | "auto" | 'auto' | Color mode (`auto` follows prefers-color-scheme). |
| sources | [] | The sources to render. JS property; omit to pass `<kai-source>` light-DOM children instead. | |
| showFavicon | boolean | false | Show favicons on all items (per-item `showFavicon` overrides). |
| numbered | boolean | false | Label each citation chip with its 1-based index in the merged list (`[1]`, `[2]`) instead of its own `label`. |
Composed from
Section titled “Composed from”This element wraps these SolidJS components — reach for them directly when you need finer control than the props expose.
SourceSourceTriggerSourceContentSourceList