@kitn.ai/ui 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +394 -0
- package/dist/bash-InADTalH.js +1 -0
- package/dist/core-AYMC6_lb.js +12 -0
- package/dist/css-M7EaDHN_.js +1 -0
- package/dist/custom-elements.json +4739 -0
- package/dist/engine-javascript-vq0WuIJl.js +141 -0
- package/dist/github-dark-dimmed-DUshB20C.js +1 -0
- package/dist/github-light-JYsPkUQd.js +1 -0
- package/dist/host-embed.d.ts +33 -0
- package/dist/html-CPZ3oZQ7.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/javascript-C25yR2R2.js +1 -0
- package/dist/json-DxJze_jm.js +1 -0
- package/dist/kitn-chat-provider.d.ts +2 -0
- package/dist/kitn-chat-provider.es.js +240 -0
- package/dist/kitn-chat.es.js +77 -0
- package/dist/llms/llms-full.txt +1018 -0
- package/dist/llms/llms.txt +104 -0
- package/dist/origin.d.ts +5 -0
- package/dist/provider-runtime.d.ts +27 -0
- package/dist/schemas/card-envelope.schema.json +14 -0
- package/dist/schemas/card-event.schema.json +12 -0
- package/dist/schemas/choice.schema.json +70 -0
- package/dist/schemas/confirm.schema.json +65 -0
- package/dist/schemas/embed.schema.json +65 -0
- package/dist/schemas/form.result.schema.json +7 -0
- package/dist/schemas/form.schema.json +33 -0
- package/dist/schemas/link.schema.json +56 -0
- package/dist/schemas/tasks.result.schema.json +16 -0
- package/dist/schemas/tasks.schema.json +78 -0
- package/dist/svelte--5p79yCD.js +1 -0
- package/dist/theme.tokens.css +176 -0
- package/dist/tsx-B8rCNbgL.js +1 -0
- package/dist/typescript-RycA9KXf.js +1 -0
- package/dist/validate.d.ts +4 -0
- package/dist/version.d.ts +4 -0
- package/dist/vue-BmIZj4XD.js +1 -0
- package/dist/wire.d.ts +53 -0
- package/frameworks/react/index.tsx +948 -0
- package/frameworks/react/runtime.tsx +94 -0
- package/llms-full.txt +1018 -0
- package/llms.txt +104 -0
- package/package.json +141 -0
- package/src/components/artifact.stories.tsx +138 -0
- package/src/components/artifact.tsx +743 -0
- package/src/components/attachments.stories.tsx +303 -0
- package/src/components/attachments.test.tsx +64 -0
- package/src/components/attachments.tsx +399 -0
- package/src/components/card-fallback.tsx +28 -0
- package/src/components/card-renderer.tsx +52 -0
- package/src/components/card.tsx +110 -0
- package/src/components/chain-of-thought.stories.tsx +211 -0
- package/src/components/chain-of-thought.tsx +139 -0
- package/src/components/chat-container.stories.tsx +187 -0
- package/src/components/chat-container.tsx +82 -0
- package/src/components/chat-scope-picker.tsx +47 -0
- package/src/components/chat-thread.test.tsx +58 -0
- package/src/components/chat-thread.tsx +249 -0
- package/src/components/checkpoint.stories.tsx +102 -0
- package/src/components/checkpoint.tsx +88 -0
- package/src/components/choice-card.tsx +569 -0
- package/src/components/code-block.stories.tsx +150 -0
- package/src/components/code-block.tsx +105 -0
- package/src/components/component-meta.json +3735 -0
- package/src/components/confirm-card.stories.tsx +74 -0
- package/src/components/confirm-card.tsx +315 -0
- package/src/components/context.stories.tsx +229 -0
- package/src/components/context.test.tsx +133 -0
- package/src/components/context.tsx +363 -0
- package/src/components/conversation-item.stories.tsx +125 -0
- package/src/components/conversation-item.tsx +16 -0
- package/src/components/conversation-list.stories.tsx +133 -0
- package/src/components/conversation-list.tsx +101 -0
- package/src/components/default-input.test.tsx +111 -0
- package/src/components/embed.tsx +196 -0
- package/src/components/empty.stories.tsx +434 -0
- package/src/components/empty.tsx +166 -0
- package/src/components/feedback-bar.stories.tsx +138 -0
- package/src/components/feedback-bar.test.tsx +103 -0
- package/src/components/feedback-bar.tsx +166 -0
- package/src/components/file-tree.stories.tsx +73 -0
- package/src/components/file-tree.tsx +383 -0
- package/src/components/file-upload.stories.tsx +156 -0
- package/src/components/file-upload.tsx +161 -0
- package/src/components/form-widgets.tsx +461 -0
- package/src/components/form.tsx +873 -0
- package/src/components/image.stories.tsx +89 -0
- package/src/components/image.tsx +67 -0
- package/src/components/link-preview.tsx +194 -0
- package/src/components/loader.stories.tsx +181 -0
- package/src/components/loader.tsx +333 -0
- package/src/components/markdown.stories.tsx +180 -0
- package/src/components/markdown.tsx +81 -0
- package/src/components/message-action-bar.test.tsx +128 -0
- package/src/components/message-narrow.stories.tsx +329 -0
- package/src/components/message-skills.stories.tsx +211 -0
- package/src/components/message-skills.tsx +36 -0
- package/src/components/message.stories.tsx +281 -0
- package/src/components/message.tsx +227 -0
- package/src/components/model-switcher.stories.tsx +123 -0
- package/src/components/model-switcher.test.tsx +65 -0
- package/src/components/model-switcher.tsx +87 -0
- package/src/components/prompt-input.stories.tsx +222 -0
- package/src/components/prompt-input.tsx +211 -0
- package/src/components/prompt-suggestion.stories.tsx +142 -0
- package/src/components/prompt-suggestion.tsx +115 -0
- package/src/components/reasoning.stories.tsx +140 -0
- package/src/components/reasoning.tsx +156 -0
- package/src/components/resizable.test.tsx +226 -0
- package/src/components/response-stream.tsx +103 -0
- package/src/components/scroll-button.stories.tsx +100 -0
- package/src/components/scroll-button.tsx +34 -0
- package/src/components/slash-command.stories.tsx +163 -0
- package/src/components/slash-command.tsx +232 -0
- package/src/components/source-list.test.tsx +152 -0
- package/src/components/source.stories.tsx +124 -0
- package/src/components/source.tsx +129 -0
- package/src/components/tasks-card.stories.tsx +78 -0
- package/src/components/tasks-card.tsx +432 -0
- package/src/components/text-shimmer.stories.tsx +87 -0
- package/src/components/text-shimmer.tsx +37 -0
- package/src/components/thinking-bar.stories.tsx +87 -0
- package/src/components/thinking-bar.tsx +50 -0
- package/src/components/tool.stories.tsx +153 -0
- package/src/components/tool.tsx +184 -0
- package/src/components/use-card-resolution.ts +28 -0
- package/src/components/voice-input.stories.tsx +83 -0
- package/src/components/voice-input.tsx +107 -0
- package/src/elements/artifact.stories.tsx +506 -0
- package/src/elements/artifact.tsx +137 -0
- package/src/elements/attachments.stories.tsx +190 -0
- package/src/elements/attachments.tsx +136 -0
- package/src/elements/card.stories.tsx +113 -0
- package/src/elements/card.tsx +40 -0
- package/src/elements/cards.stories.tsx +59 -0
- package/src/elements/cards.tsx +97 -0
- package/src/elements/catalog.stories.tsx +491 -0
- package/src/elements/chain-of-thought.declarative.test.tsx +153 -0
- package/src/elements/chain-of-thought.stories.tsx +113 -0
- package/src/elements/chain-of-thought.tsx +92 -0
- package/src/elements/chat-scope-picker.stories.tsx +73 -0
- package/src/elements/chat-scope-picker.tsx +36 -0
- package/src/elements/chat-types.ts +42 -0
- package/src/elements/chat-workspace.stories.tsx +288 -0
- package/src/elements/chat-workspace.tsx +161 -0
- package/src/elements/chat.stories.tsx +151 -0
- package/src/elements/chat.tsx +80 -0
- package/src/elements/checkpoint.stories.tsx +72 -0
- package/src/elements/checkpoint.tsx +47 -0
- package/src/elements/choice.stories.tsx +240 -0
- package/src/elements/choice.tsx +48 -0
- package/src/elements/code-block.stories.tsx +83 -0
- package/src/elements/code-block.tsx +42 -0
- package/src/elements/compiled.css +2 -0
- package/src/elements/composed-shell.stories.tsx +316 -0
- package/src/elements/confirm-card.stories.tsx +227 -0
- package/src/elements/confirm-card.tsx +51 -0
- package/src/elements/context-meter.stories.tsx +151 -0
- package/src/elements/context-meter.tsx +121 -0
- package/src/elements/conversation-list.declarative.test.tsx +137 -0
- package/src/elements/conversation-list.stories.tsx +243 -0
- package/src/elements/conversation-list.tsx +80 -0
- package/src/elements/css.ts +5 -0
- package/src/elements/default-input.tsx +247 -0
- package/src/elements/define.tsx +171 -0
- package/src/elements/element-meta.json +3314 -0
- package/src/elements/element-types.d.ts +710 -0
- package/src/elements/embed.stories.tsx +213 -0
- package/src/elements/embed.tsx +35 -0
- package/src/elements/empty.stories.tsx +111 -0
- package/src/elements/empty.tsx +29 -0
- package/src/elements/feedback-bar.stories.tsx +114 -0
- package/src/elements/feedback-bar.tsx +61 -0
- package/src/elements/file-tree.stories.tsx +134 -0
- package/src/elements/file-tree.tsx +52 -0
- package/src/elements/file-upload.stories.tsx +82 -0
- package/src/elements/file-upload.tsx +44 -0
- package/src/elements/form.stories.tsx +248 -0
- package/src/elements/form.tsx +43 -0
- package/src/elements/framework-usage.json +563 -0
- package/src/elements/image.stories.tsx +71 -0
- package/src/elements/image.tsx +32 -0
- package/src/elements/link-preview.stories.tsx +209 -0
- package/src/elements/link-preview.tsx +34 -0
- package/src/elements/loader.stories.tsx +88 -0
- package/src/elements/loader.tsx +25 -0
- package/src/elements/markdown.stories.tsx +76 -0
- package/src/elements/markdown.tsx +38 -0
- package/src/elements/message-skills.declarative.test.tsx +104 -0
- package/src/elements/message-skills.stories.tsx +114 -0
- package/src/elements/message-skills.tsx +85 -0
- package/src/elements/message.stories.tsx +218 -0
- package/src/elements/message.tsx +162 -0
- package/src/elements/model-switcher.declarative.test.tsx +130 -0
- package/src/elements/model-switcher.stories.tsx +198 -0
- package/src/elements/model-switcher.tsx +93 -0
- package/src/elements/popover.stories.tsx +80 -0
- package/src/elements/popover.tsx +59 -0
- package/src/elements/prompt-input-slash-command.test.tsx +128 -0
- package/src/elements/prompt-input-stoppable.test.tsx +88 -0
- package/src/elements/prompt-input-toolbar-actions.test.tsx +120 -0
- package/src/elements/prompt-input.stories.tsx +331 -0
- package/src/elements/prompt-input.tsx +185 -0
- package/src/elements/prompt-suggestions.declarative.test.tsx +164 -0
- package/src/elements/prompt-suggestions.stories.tsx +213 -0
- package/src/elements/prompt-suggestions.tsx +94 -0
- package/src/elements/reasoning.stories.tsx +77 -0
- package/src/elements/reasoning.tsx +50 -0
- package/src/elements/register.ts +56 -0
- package/src/elements/remote.stories.tsx +314 -0
- package/src/elements/remote.tsx +221 -0
- package/src/elements/resizable.d.ts +27 -0
- package/src/elements/resizable.stories.tsx +426 -0
- package/src/elements/resizable.tsx +553 -0
- package/src/elements/response-stream.stories.tsx +79 -0
- package/src/elements/response-stream.tsx +40 -0
- package/src/elements/scroll-button.stories.tsx +202 -0
- package/src/elements/scroll-button.test.tsx +148 -0
- package/src/elements/scroll-button.tsx +126 -0
- package/src/elements/source-list.stories.tsx +143 -0
- package/src/elements/source.stories.tsx +88 -0
- package/src/elements/source.tsx +120 -0
- package/src/elements/styles.css +199 -0
- package/src/elements/switch.stories.tsx +56 -0
- package/src/elements/switch.tsx +43 -0
- package/src/elements/tasks.stories.tsx +237 -0
- package/src/elements/tasks.tsx +46 -0
- package/src/elements/text-shimmer.stories.tsx +64 -0
- package/src/elements/text-shimmer.tsx +28 -0
- package/src/elements/thinking-bar.stories.tsx +72 -0
- package/src/elements/thinking-bar.tsx +34 -0
- package/src/elements/tool.stories.tsx +89 -0
- package/src/elements/tool.tsx +23 -0
- package/src/elements/voice-input.stories.tsx +88 -0
- package/src/elements/voice-input.tsx +41 -0
- package/src/index.ts +253 -0
- package/src/primitives/card-contract.ts +71 -0
- package/src/primitives/card-host.tsx +35 -0
- package/src/primitives/card-registry.tsx +67 -0
- package/src/primitives/card-resolution.ts +36 -0
- package/src/primitives/card-routing.ts +79 -0
- package/src/primitives/card-schemas/card-envelope.schema.json +14 -0
- package/src/primitives/card-schemas/card-event.schema.json +12 -0
- package/src/primitives/card-schemas/choice.schema.json +70 -0
- package/src/primitives/card-schemas/confirm.schema.json +65 -0
- package/src/primitives/card-schemas/embed.schema.json +65 -0
- package/src/primitives/card-schemas/form.result.schema.json +7 -0
- package/src/primitives/card-schemas/form.schema.json +33 -0
- package/src/primitives/card-schemas/link.schema.json +56 -0
- package/src/primitives/card-schemas/tasks.result.schema.json +16 -0
- package/src/primitives/card-schemas/tasks.schema.json +78 -0
- package/src/primitives/card-validate.ts +95 -0
- package/src/primitives/chat-config.tsx +76 -0
- package/src/primitives/controllable.test.ts +47 -0
- package/src/primitives/controllable.ts +21 -0
- package/src/primitives/embed-providers.ts +254 -0
- package/src/primitives/highlighter.ts +157 -0
- package/src/primitives/link-preview.ts +87 -0
- package/src/primitives/pdf-preview.ts +121 -0
- package/src/primitives/use-auto-resize.ts +31 -0
- package/src/primitives/use-resize-observer.ts +12 -0
- package/src/primitives/use-stick-to-bottom.ts +43 -0
- package/src/primitives/use-text-stream.ts +112 -0
- package/src/primitives/use-voice-recorder.ts +50 -0
- package/src/remote/host-embed.ts +345 -0
- package/src/remote/index.ts +2 -0
- package/src/remote/origin.ts +30 -0
- package/src/remote/provider-runtime.ts +259 -0
- package/src/remote/provider.ts +2 -0
- package/src/remote/validate.ts +22 -0
- package/src/remote/version.ts +12 -0
- package/src/remote/wire.ts +48 -0
- package/src/stories/chat-panel-layout.stories.tsx +145 -0
- package/src/stories/chat-scene.tsx +571 -0
- package/src/stories/checkpoint-restore.stories.tsx +256 -0
- package/src/stories/context-usage.stories.tsx +212 -0
- package/src/stories/conversation-with-reasoning.stories.tsx +182 -0
- package/src/stories/conversation-with-sources.stories.tsx +471 -0
- package/src/stories/docs/Accessibility.mdx +119 -0
- package/src/stories/docs/ChildElements.mdx +269 -0
- package/src/stories/docs/ForAIAgents.mdx +162 -0
- package/src/stories/docs/GettingStarted.mdx +65 -0
- package/src/stories/docs/Installation.mdx +83 -0
- package/src/stories/docs/Introduction.mdx +50 -0
- package/src/stories/docs/SolidJsAdvanced.mdx +17 -0
- package/src/stories/docs/Theming.mdx +85 -0
- package/src/stories/docs/element-controls.ts +121 -0
- package/src/stories/docs/frameworks/Angular.mdx +245 -0
- package/src/stories/docs/frameworks/Html.mdx +227 -0
- package/src/stories/docs/frameworks/Overview.mdx +47 -0
- package/src/stories/docs/frameworks/React.mdx +227 -0
- package/src/stories/docs/frameworks/Solid.mdx +173 -0
- package/src/stories/docs/frameworks/Svelte.mdx +194 -0
- package/src/stories/docs/frameworks/Vue.mdx +238 -0
- package/src/stories/docs/generative-ui-overview.mdx +186 -0
- package/src/stories/docs/recipes/SpeechToText.mdx +7 -0
- package/src/stories/docs/recipes/Streaming.mdx +68 -0
- package/src/stories/docs/recipes/TextToSpeech.mdx +35 -0
- package/src/stories/docs/theme-editor/canvas.tsx +32 -0
- package/src/stories/docs/theme-editor/inspector.tsx +66 -0
- package/src/stories/docs/theme-editor/presets.test.ts +32 -0
- package/src/stories/docs/theme-editor/presets.ts +64 -0
- package/src/stories/docs/theme-editor/theme-css.test.ts +19 -0
- package/src/stories/docs/theme-editor/theme-css.ts +15 -0
- package/src/stories/docs/theme-editor/theme-editor.tsx +146 -0
- package/src/stories/docs/theme-tokens.tsx +174 -0
- package/src/stories/examples/ChoosingComponents.mdx +106 -0
- package/src/stories/examples/sample-data.ts +79 -0
- package/src/stories/examples/usage/checkpoint-restore.ts +156 -0
- package/src/stories/examples/usage/context-usage.ts +591 -0
- package/src/stories/examples/usage/conversation-with-reasoning.ts +224 -0
- package/src/stories/examples/usage/conversation-with-sources.ts +589 -0
- package/src/stories/examples/usage/empty-state.ts +144 -0
- package/src/stories/examples/usage/full-chat-app.ts +277 -0
- package/src/stories/examples/usage/index.ts +63 -0
- package/src/stories/examples/usage/message-actions.ts +704 -0
- package/src/stories/examples/usage/pattern-centered-conversation.ts +446 -0
- package/src/stories/examples/usage/pattern-chat-panel-layout.ts +442 -0
- package/src/stories/examples/usage/pattern-docked-widget.ts +479 -0
- package/src/stories/examples/usage/prompt-input-variants.ts +1356 -0
- package/src/stories/examples/usage/streaming-response.ts +687 -0
- package/src/stories/examples/usage/types.ts +33 -0
- package/src/stories/full-chat.stories.tsx +18 -0
- package/src/stories/message-actions.stories.tsx +230 -0
- package/src/stories/pattern-centered-conversation.stories.tsx +93 -0
- package/src/stories/pattern-docked-widget.stories.tsx +93 -0
- package/src/stories/pattern-empty-state.stories.tsx +76 -0
- package/src/stories/prompt-input-variants.stories.tsx +456 -0
- package/src/stories/streaming-response.stories.tsx +438 -0
- package/src/stories/theme-editor.stories.tsx +16 -0
- package/src/stories/token-reference.stories.tsx +18 -0
- package/src/stories/typography.stories.tsx +78 -0
- package/src/types.ts +47 -0
- package/src/ui/action-icons.ts +52 -0
- package/src/ui/avatar.stories.tsx +103 -0
- package/src/ui/avatar.tsx +23 -0
- package/src/ui/badge.stories.tsx +86 -0
- package/src/ui/badge.tsx +21 -0
- package/src/ui/button.stories.tsx +145 -0
- package/src/ui/button.tsx +38 -0
- package/src/ui/collapsible.stories.tsx +69 -0
- package/src/ui/collapsible.tsx +125 -0
- package/src/ui/dropdown.stories.tsx +59 -0
- package/src/ui/dropdown.tsx +196 -0
- package/src/ui/hover-card.stories.tsx +77 -0
- package/src/ui/hover-card.test.tsx +30 -0
- package/src/ui/hover-card.tsx +172 -0
- package/src/ui/overlay.stories.tsx +115 -0
- package/src/ui/overlay.tsx +158 -0
- package/src/ui/popover.stories.tsx +81 -0
- package/src/ui/popover.test.tsx +99 -0
- package/src/ui/popover.tsx +92 -0
- package/src/ui/resizable.stories.tsx +236 -0
- package/src/ui/resizable.tsx +576 -0
- package/src/ui/scroll-area.stories.tsx +50 -0
- package/src/ui/scroll-area.tsx +15 -0
- package/src/ui/separator.stories.tsx +81 -0
- package/src/ui/separator.tsx +10 -0
- package/src/ui/skeleton.stories.tsx +337 -0
- package/src/ui/skeleton.tsx +16 -0
- package/src/ui/switch.stories.tsx +51 -0
- package/src/ui/switch.test.tsx +59 -0
- package/src/ui/switch.tsx +62 -0
- package/src/ui/textarea.stories.tsx +76 -0
- package/src/ui/textarea.tsx +21 -0
- package/src/ui/tooltip.stories.tsx +74 -0
- package/src/ui/tooltip.tsx +68 -0
- package/src/utils/cn.ts +24 -0
- package/theme.css +187 -0
|
@@ -0,0 +1,1018 @@
|
|
|
1
|
+
<!-- AUTO-GENERATED by scripts/gen-llms.mjs — do not edit by hand. Run `npm run build`. -->
|
|
2
|
+
# @kitn.ai/ui — Full Reference
|
|
3
|
+
|
|
4
|
+
# @kitn.ai/ui
|
|
5
|
+
|
|
6
|
+
> Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. 44 `kitn-*` custom elements: streaming responses, markdown + code rendering, reasoning/tool panels, attachments, conversation sidebar, voice input. Zero framework dependency for consumers; the SolidJS runtime it is authored in is bundled in, so the host needs nothing.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @kitn.ai/ui
|
|
12
|
+
# SolidJS consumers also need the peer dep:
|
|
13
|
+
npm install solid-js
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## #1 rule: array/object data goes on JS PROPERTIES, not HTML attributes
|
|
17
|
+
|
|
18
|
+
This is the single most common mistake. Arrays and objects (`messages`, `models`, `context`, `suggestions`, `slashCommands`, …) MUST be assigned as JavaScript properties on the element. They CANNOT be passed as HTML attributes — an HTML attribute is always a string and will be ignored or mis-parsed.
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const chat = document.querySelector('kai-chat');
|
|
22
|
+
chat.messages = [{ id: '1', role: 'assistant', content: 'Hi!' }]; // ✅ property
|
|
23
|
+
```
|
|
24
|
+
```html
|
|
25
|
+
<kai-chat messages="[...]"></kai-chat> <!-- ❌ never works -->
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Only scalar values (string/number/boolean) work as attributes (e.g. `placeholder`, `loading`, `theme`).
|
|
29
|
+
|
|
30
|
+
## Two layers
|
|
31
|
+
|
|
32
|
+
**Layer 1 — batteries-included web components** (`import '@kitn.ai/ui/elements'`):
|
|
33
|
+
Drop an element into any framework (React, Vue, plain HTML). Data in via JS properties; interactions out via non-bubbling CustomEvents.
|
|
34
|
+
|
|
35
|
+
- `<kai-chat>` — full chat UI (message list + prompt input). The primary starting point.
|
|
36
|
+
- `<kai-conversations>` — sidebar conversation browser with group support.
|
|
37
|
+
- `<kai-prompt-input>` — standalone composer with send button.
|
|
38
|
+
|
|
39
|
+
**Layer 2 — composable primitives** (`import { … } from '@kitn.ai/ui'`):
|
|
40
|
+
All 44 elements are also exported individually. Use them for custom layouts or features `<kai-chat>` does not expose (ChainOfThought, FeedbackBar, ThinkingBar, VoiceInput, …). Your bundler tree-shakes the rest.
|
|
41
|
+
|
|
42
|
+
## Key rules for the web components
|
|
43
|
+
|
|
44
|
+
1. **Array/object data = JS properties** (see above). Scalars may be attributes.
|
|
45
|
+
2. **Events are non-bubbling `CustomEvent`s** — listen directly on the element:
|
|
46
|
+
`chat.addEventListener('kai-submit', (e) => console.log(e.detail.value))`
|
|
47
|
+
3. **`theme` attribute** (`'light' | 'dark' | 'auto'`) works on every element. Default `auto` follows `prefers-color-scheme`.
|
|
48
|
+
4. **Theming via CSS custom properties** — override `--kai-color-*` tokens on `:root`; they pierce Shadow DOM.
|
|
49
|
+
|
|
50
|
+
## ChatMessage schema (required for `<kai-chat>`)
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
interface ChatMessage {
|
|
54
|
+
id: string;
|
|
55
|
+
role: 'user' | 'assistant';
|
|
56
|
+
content: string;
|
|
57
|
+
reasoning?: { text: string; label?: string };
|
|
58
|
+
tools?: ToolPart[];
|
|
59
|
+
attachments?: AttachmentData[];
|
|
60
|
+
actions?: ('copy' | 'like' | 'dislike' | 'regenerate' | 'edit')[];
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Framework wiring
|
|
65
|
+
|
|
66
|
+
**Plain HTML / CDN**
|
|
67
|
+
```html
|
|
68
|
+
<script type="module" src="https://unpkg.com/@kitn.ai/ui/elements"></script>
|
|
69
|
+
<kai-chat style="display:block;height:100vh"></kai-chat>
|
|
70
|
+
<script type="module">
|
|
71
|
+
const chat = document.querySelector('kai-chat');
|
|
72
|
+
chat.messages = [];
|
|
73
|
+
</script>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**React** — typed wrappers auto-set properties and expose `on<Event>` props:
|
|
77
|
+
```tsx
|
|
78
|
+
import { Chat } from '@kitn.ai/ui/react';
|
|
79
|
+
<Chat messages={messages} onSubmit={(e) => send(e.detail.value)} />
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Vue** — use the element directly; pass arrays via `.prop`:
|
|
83
|
+
```vue
|
|
84
|
+
<kai-chat :messages.prop="messages" @kai-submit="send" />
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Theming
|
|
88
|
+
|
|
89
|
+
```css
|
|
90
|
+
:root {
|
|
91
|
+
--kai-color-background: #0f0f0f;
|
|
92
|
+
--kai-color-primary: #7c3aed;
|
|
93
|
+
--kai-color-muted: #1e1e1e;
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
For plain HTML/CDN: `<link rel="stylesheet" href="…/@kitn.ai/ui/theme.tokens.css">`.
|
|
98
|
+
For Tailwind builds: `@import "@kitn.ai/ui/theme.css"` in your CSS.
|
|
99
|
+
|
|
100
|
+
## Docs
|
|
101
|
+
|
|
102
|
+
- Full element reference (all 44 elements, every prop/event): ./llms-full.txt — https://kitn.dev/llms-full.txt
|
|
103
|
+
- Machine-readable Custom Elements Manifest: https://unpkg.com/@kitn.ai/ui/dist/custom-elements.json
|
|
104
|
+
- Working examples: https://github.com/kitn-ai/ui/tree/main/examples
|
|
105
|
+
- Storybook: https://storybook.kitn.dev
|
|
106
|
+
- Repository: https://github.com/kitn-ai/ui
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## How to build a chat app in 5 steps
|
|
111
|
+
|
|
112
|
+
### 1 — Install
|
|
113
|
+
```bash
|
|
114
|
+
npm install @kitn.ai/ui
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 2 — Pick your layer
|
|
118
|
+
Drop-in: use `<kai-chat>` for a full chat UI in one tag (`import '@kitn.ai/ui/elements'`).
|
|
119
|
+
Composable: combine `<kai-message>`, `<kai-prompt-input>`, `<kai-reasoning>`, … in your own markup.
|
|
120
|
+
|
|
121
|
+
### 3 — Handle `submit` and stream
|
|
122
|
+
```js
|
|
123
|
+
import '@kitn.ai/ui/elements';
|
|
124
|
+
const chat = document.querySelector('kai-chat');
|
|
125
|
+
chat.messages = [];
|
|
126
|
+
|
|
127
|
+
chat.addEventListener('kai-submit', async (e) => {
|
|
128
|
+
const userText = e.detail.value;
|
|
129
|
+
|
|
130
|
+
// Append the user message (new array — see streaming note)
|
|
131
|
+
const history = [...chat.messages, { id: crypto.randomUUID(), role: 'user', content: userText }];
|
|
132
|
+
chat.messages = history;
|
|
133
|
+
chat.loading = true;
|
|
134
|
+
|
|
135
|
+
// Add an empty assistant placeholder to stream into
|
|
136
|
+
const aid = crypto.randomUUID();
|
|
137
|
+
chat.messages = [...history, { id: aid, role: 'assistant', content: '' }];
|
|
138
|
+
|
|
139
|
+
let answer = '';
|
|
140
|
+
for await (const token of streamFromYourAPI(history)) {
|
|
141
|
+
answer += token;
|
|
142
|
+
chat.messages = chat.messages.map((m) => (m.id === aid ? { ...m, content: answer } : m));
|
|
143
|
+
}
|
|
144
|
+
chat.loading = false;
|
|
145
|
+
});
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 4 — Wire optional features
|
|
149
|
+
- Reasoning: add `reasoning: { text: '…' }` to an assistant message.
|
|
150
|
+
- Tool calls: add `tools: [{ type: 'search', state: 'output-available', input: {…}, output: {…} }]`.
|
|
151
|
+
- Model switcher: `chat.models = [{ id: 'gpt-4o', name: 'GPT-4o' }]; chat.currentModel = 'gpt-4o';` — listen for `modelchange`.
|
|
152
|
+
- Token meter: `chat.context = { usedTokens: 1200, maxTokens: 128000 };`.
|
|
153
|
+
- History sidebar: add `<kai-conversations>`; listen for `select` and `newchat`.
|
|
154
|
+
|
|
155
|
+
### 5 — Theme
|
|
156
|
+
Override `--kai-color-*` tokens on `:root` (they pierce Shadow DOM).
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Streaming recipe (critical)
|
|
161
|
+
|
|
162
|
+
To update messages while streaming, **reassign a NEW array containing a NEW message object** on every chunk. Mutating an existing message object in place will NOT trigger a re-render:
|
|
163
|
+
|
|
164
|
+
```js
|
|
165
|
+
// ✅ re-renders
|
|
166
|
+
chat.messages = chat.messages.map((m) => (m.id === id ? { ...m, content: next } : m));
|
|
167
|
+
|
|
168
|
+
// ❌ does NOT re-render
|
|
169
|
+
chat.messages[i].content = next;
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
The same rule applies to every array/object property (`models`, `context`, `suggestions`, …): replace, don't mutate.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Element reference (44 elements, generated from custom-elements.json)
|
|
177
|
+
|
|
178
|
+
Every element also accepts the `theme` attribute. Array/object properties are marked with a `—` attribute: they must be set as JS properties.
|
|
179
|
+
|
|
180
|
+
### `kai-artifact` / `Artifact`
|
|
181
|
+
|
|
182
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
183
|
+
|
|
184
|
+
| Property | Attribute | Type | Description |
|
|
185
|
+
|---|---|---|---|
|
|
186
|
+
| `src` | `src` | `undefined \| string` | URL the preview iframe frames. Consumer-controlled. |
|
|
187
|
+
| `files` | — | `{ path: string; url?: undefined \| string; code?: undefined \| string; language?: undefined \| string; type?: undefined \| "html" \| "pdf" \| "image" \| "other" }[]` | Files for the Code tab tree + each file's preview `url`. Set as a JS property (array). |
|
|
188
|
+
| `tab` | `tab` | `undefined \| "preview" \| "code"` | Active tab: `preview` (default) or `code`. |
|
|
189
|
+
| `activeFile` | `active-file` | `undefined \| string` | Selected file path — syncs the tree highlight, Code source, and preview. |
|
|
190
|
+
| `sandbox` | `sandbox` | `undefined \| string` | iframe `sandbox` override. Secure default `allow-scripts allow-forms` (NOT `allow-same-origin`). |
|
|
191
|
+
| `iframeTitle` | `iframe-title` | `undefined \| string` | Accessible title for the preview iframe. |
|
|
192
|
+
| `maximized` | `maximized` | `undefined \| false \| true` | Reflects the artifact's own maximized view-state (usually driven by the protocol). |
|
|
193
|
+
| `expandable` | `expandable` | `undefined \| false \| true` | Show the expand-to-fill button (OPT-IN). |
|
|
194
|
+
| `openInTab` | `open-in-tab` | `undefined \| false \| true` | Show the open-in-new-tab button (OPT-IN). |
|
|
195
|
+
| `noNav` | `no-nav` | `undefined \| false \| true` | Hide back/forward. |
|
|
196
|
+
| `noReload` | `no-reload` | `undefined \| false \| true` | Hide reload. |
|
|
197
|
+
| `noHome` | `no-home` | `undefined \| false \| true` | Hide home. |
|
|
198
|
+
| `noPathField` | `no-path-field` | `undefined \| false \| true` | Hide the address field. |
|
|
199
|
+
| `noTabs` | `no-tabs` | `undefined \| false \| true` | Hide the Preview\|Code toggle. |
|
|
200
|
+
| `standalone` | `standalone` | `undefined \| false \| true` | Standalone chrome: rounded corners + border (else square, borderless in-panel). |
|
|
201
|
+
| `readonlyPath` | `readonly-path` | `undefined \| false \| true` | Show the address but make it read-only (visible, nav-tracking, non-editable). |
|
|
202
|
+
|
|
203
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
204
|
+
|
|
205
|
+
| Event | `detail` type | Description |
|
|
206
|
+
|---|---|---|
|
|
207
|
+
| `kai-file-select` | `CustomEvent<{ path: string }>` | Fired when a file is selected. `detail.path`. |
|
|
208
|
+
| `kai-maximize-change` | `CustomEvent<{ maximized: false \| true }>` | Artifact's own maximize button toggled (consumer-observable; non-bubbling). |
|
|
209
|
+
| `kai-navigate` | `CustomEvent<{ url: string }>` | Fired when the preview navigates. `detail.url` = the new location. |
|
|
210
|
+
| `kai-tab-change` | `CustomEvent<{ tab: "preview" \| "code" }>` | Fired when the Preview\|Code tab changes. `detail.tab`. |
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
### `kai-attachments` / `Attachments`
|
|
215
|
+
|
|
216
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
217
|
+
|
|
218
|
+
| Property | Attribute | Type | Description |
|
|
219
|
+
|---|---|---|---|
|
|
220
|
+
| `items` | — | `{ id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[]` | The attachments to render. Set as a JS property (array). |
|
|
221
|
+
| `variant` | `variant` | `undefined \| "grid" \| "inline" \| "list"` | Layout: `grid` = visual tiles, `inline` = icon + label chips, `list` = rows. |
|
|
222
|
+
| `hoverCard` | `hover-card` | `undefined \| false \| true` | Wrap each item in a hover card that previews its details. |
|
|
223
|
+
| `removable` | `removable` | `undefined \| false \| true` | Show a remove button per item; clicking it fires a `kai-remove` event. |
|
|
224
|
+
| `showMediaType` | `show-media-type` | `undefined \| false \| true` | Also show the media type beneath the filename (non-grid variants). |
|
|
225
|
+
| `emptyText` | `empty-text` | `undefined \| string` | Text shown when `items` is empty. |
|
|
226
|
+
|
|
227
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
228
|
+
|
|
229
|
+
| Event | `detail` type | Description |
|
|
230
|
+
|---|---|---|
|
|
231
|
+
| `kai-remove` | `CustomEvent<{ id: string }>` | A remove button was clicked. |
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
### `kai-card` / `Card`
|
|
236
|
+
|
|
237
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
238
|
+
|
|
239
|
+
| Property | Attribute | Type | Description |
|
|
240
|
+
|---|---|---|---|
|
|
241
|
+
| `heading` | `heading` | `undefined \| string` | Heading rendered in the card chrome (= CardEnvelope.title). Attribute: `heading`. |
|
|
242
|
+
| `description` | `description` | `undefined \| string` | Supporting text under the heading. Attribute: `description`. |
|
|
243
|
+
| `errorMessage` | `error-message` | `undefined \| string` | When set, the card renders its inline error state instead of the body. Attribute: `error-message`. |
|
|
244
|
+
| `dense` | `dense` | `undefined \| false \| true` | Compact spacing for dense lists. Attribute: `dense`. |
|
|
245
|
+
|
|
246
|
+
_No events._
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
### `kai-cards` / `Cards`
|
|
251
|
+
|
|
252
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
253
|
+
|
|
254
|
+
| Property | Attribute | Type | Description |
|
|
255
|
+
|---|---|---|---|
|
|
256
|
+
| `cards` | — | `undefined \| { type: string; id: string; data: unknown; title?: undefined \| string; resolution?: undefined \| { kind: "action"; action: string; payload?: unknown; at?: undefined \| string } \| { kind: "submit"; data: unknown; at?: undefined \| string } }[]` | The stream of card envelopes to render. Set as a JS PROPERTY: `el.cards = [...]`. |
|
|
257
|
+
| `types` | — | `undefined \| Record<string, string>` | Optional type→tag overrides/additions (merged over the built-ins). Property: `el.types`. Typed as a plain string map (not the `CardTagMap` alias) so the generated React wrapper inlines it instead of emitting an unresolved named type. |
|
|
258
|
+
| `policy` | — | `undefined \| { onSubmit?: undefined \| (cardId: string, data: unknown) => void; onAction?: undefined \| (cardId: string, action: string, payload?: unknown) => void; onSendPrompt?: undefined \| (text: string, opts: { mode: "compose" \| "send"; context?: unknown; }) => void; onOpen?: undefined \| (url: string, target: "tab" \| "artifact") => void; onState?: undefined \| (cardId: string, patch: unknown) => void; onDismiss?: undefined \| (cardId: string) => void; onError?: undefined \| (cardId: string, message: string) => void; maxSendPromptMode?: undefined \| "compose" \| "send" }` | Optional CardPolicy handling child events. Property: `el.policy`. |
|
|
259
|
+
|
|
260
|
+
_No events._
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
### `kai-chain-of-thought` / `ChainOfThought`
|
|
265
|
+
|
|
266
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
267
|
+
|
|
268
|
+
| Property | Attribute | Type | Description |
|
|
269
|
+
|---|---|---|---|
|
|
270
|
+
| `steps` | — | `{ label: string; content?: undefined \| string }[]` | The reasoning steps. Set as a JS property. Compound sub-parts collapse to this one data model (Route 1). |
|
|
271
|
+
|
|
272
|
+
_No events._
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
### `kai-chat` / `Chat`
|
|
277
|
+
|
|
278
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
279
|
+
|
|
280
|
+
| Property | Attribute | Type | Description |
|
|
281
|
+
|---|---|---|---|
|
|
282
|
+
| `messages` | — | `{ id: string; role: "user" \| "assistant"; content: string; reasoning?: undefined \| { text: string; label?: undefined \| string }; tools?: undefined \| { type: string; state: "input-streaming" \| "input-available" \| "output-available" \| "output-error"; input?: undefined \| Record<string, unknown>; output?: undefined \| Record<string, unknown>; toolCallId?: undefined \| string; errorText?: undefined \| string }[]; attachments?: undefined \| { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[]; actions?: undefined \| ("copy" \| "like" \| "dislike" \| "regenerate" \| "edit" \| { id: string; label: string; icon?: undefined \| string; tooltip?: undefined \| string })[]; avatar?: undefined \| { src?: undefined \| string; fallback?: undefined \| string; alt?: undefined \| string } }[]` | The full message thread to render, newest last. Each entry carries its role, content, and optional reasoning/tools/attachments/actions. Set as a JS property (`el.messages = [...]`). |
|
|
283
|
+
| `value` | `value` | `undefined \| string` | Controlled value of the input. When set, the host owns the input text and must update it on `kai-value-change`; leave unset for uncontrolled behavior. |
|
|
284
|
+
| `placeholder` | `placeholder` | `undefined \| string` | Placeholder text shown in the empty input. |
|
|
285
|
+
| `loading` | `loading` | `undefined \| false \| true` | When true, shows the loading/streaming state and disables submit (use while awaiting the assistant's reply). |
|
|
286
|
+
| `suggestions` | — | `undefined \| string[]` | Starter prompts shown above the input when the thread is empty. Clicking one follows `suggestionMode`. Set as a JS property. |
|
|
287
|
+
| `suggestionMode` | `suggestion-mode` | `undefined \| "submit" \| "fill"` | What clicking a suggestion does: `'submit'` (default) sends it immediately as if typed and submitted; `'fill'` just places it in the input. |
|
|
288
|
+
| `persistSuggestions` | `persist-suggestions` | `undefined \| false \| true` | Keep suggestions visible after the conversation starts. By default suggestions are conversation starters and hide once `messages` is non-empty; set this to keep them always shown. Default false. |
|
|
289
|
+
| `proseSize` | `prose-size` | `undefined \| "xs" \| "sm" \| "base" \| "lg"` | Body/prose font scale for rendered markdown (`'xs' \| 'sm' \| 'base' \| 'lg'`). Defaults to `'sm'`. |
|
|
290
|
+
| `codeTheme` | `code-theme` | `undefined \| string` | Shiki theme name for syntax-highlighted code blocks (e.g. `'github-dark-dimmed'`). |
|
|
291
|
+
| `codeHighlight` | `code-highlight` | `undefined \| false \| true` | Enable Shiki syntax highlighting in code blocks. Turn off to render plain `<pre>` blocks (lighter, no highlighter load). Default true. |
|
|
292
|
+
| `chatTitle` | `chat-title` | `undefined \| string` | Optional header title shown on the left of the header. |
|
|
293
|
+
| `models` | — | `undefined \| { id: string; name: string; provider?: undefined \| string; description?: undefined \| string; group?: undefined \| string }[]` | Optional model list. When set (>1 model) a ModelSwitcher is shown in the header and a `kai-model-change` event fires on selection. |
|
|
294
|
+
| `currentModel` | `current-model` | `undefined \| string` | The currently selected model id (pairs with `models`). |
|
|
295
|
+
| `context` | — | `undefined \| { usedTokens: number; maxTokens: number; inputTokens?: undefined \| number; outputTokens?: undefined \| number; estimatedCost?: undefined \| number }` | Optional context-window token usage. When set, a Context token meter is shown in the header. |
|
|
296
|
+
| `scrollButton` | `scroll-button` | `undefined \| false \| true` | Show the scroll-to-bottom button inside the scroll area. Default true. |
|
|
297
|
+
| `headerStart` | `header-start` | `undefined \| false \| true` | Whether the host has `slot="header-start"` content (left of the title) — set by the `<kai-chat>` facade so a custom control forces the header open. |
|
|
298
|
+
| `headerEnd` | `header-end` | `undefined \| false \| true` | Whether the host has `slot="header-end"` content (right of the controls). |
|
|
299
|
+
| `search` | `search` | `undefined \| false \| true` | Show a Search (Globe) button in the input toolbar; fires a `search` event. |
|
|
300
|
+
| `voice` | `voice` | `undefined \| false \| true` | Show a Voice (Mic) button in the input toolbar; fires a `voice` event. |
|
|
301
|
+
| `slashCommands` | — | `undefined \| { id: string; label: string; description?: undefined \| string; category?: undefined \| string }[]` | Slash commands — when set, typing `/` in the input opens the command palette and fires `kai-slash-select`. Set as a JS property. |
|
|
302
|
+
| `slashActiveIds` | — | `undefined \| string[]` | Command ids to highlight as active in the palette. |
|
|
303
|
+
| `slashCompact` | `slash-compact` | `undefined \| false \| true` | Single-line palette rows. |
|
|
304
|
+
| `actionsReveal` | `actions-reveal` | `undefined \| "always" \| "hover"` | Whether each message's action bar is always visible (`'always'`, default) or only revealed on hover of that message row (`'hover'`). |
|
|
305
|
+
|
|
306
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
307
|
+
|
|
308
|
+
| Event | `detail` type | Description |
|
|
309
|
+
|---|---|---|
|
|
310
|
+
| `kai-message-action` | `CustomEvent<{ messageId: string; action: string }>` | An action button on a message was clicked. `action` is the built-in name or custom id. |
|
|
311
|
+
| `kai-model-change` | `CustomEvent<{ modelId: string }>` | The header model switcher changed. |
|
|
312
|
+
| `kai-search` | `CustomEvent<Record<string, never>>` | The Search button was clicked. |
|
|
313
|
+
| `kai-slash-select` | `CustomEvent<{ command: { id: string; label: string; description?: undefined \| string; category?: undefined \| string } }>` | A slash command was chosen from the palette. |
|
|
314
|
+
| `kai-submit` | `CustomEvent<{ value: string; attachments: { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[] }>` | User submitted a message. |
|
|
315
|
+
| `kai-suggestion-click` | `CustomEvent<{ value: string }>` | A suggestion chip was clicked (only in `suggestion-mode="fill"`). |
|
|
316
|
+
| `kai-value-change` | `CustomEvent<{ value: string }>` | Fired on every input change. |
|
|
317
|
+
| `kai-voice` | `CustomEvent<Record<string, never>>` | The Mic / voice button was clicked. |
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
### `kai-checkpoint` / `Checkpoint`
|
|
322
|
+
|
|
323
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
324
|
+
|
|
325
|
+
| Property | Attribute | Type | Description |
|
|
326
|
+
|---|---|---|---|
|
|
327
|
+
| `label` | `label` | `undefined \| string` | Optional text beside the icon. |
|
|
328
|
+
| `tooltip` | `tooltip` | `undefined \| string` | Tooltip on hover. |
|
|
329
|
+
| `variant` | `variant` | `undefined \| "ghost" \| "default" \| "outline"` | Visual button style. |
|
|
330
|
+
| `size` | `size` | `undefined \| "sm" \| "lg" \| "md" \| "icon" \| "icon-sm"` | Button size (use an `icon*` size for an icon-only checkpoint). |
|
|
331
|
+
|
|
332
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
333
|
+
|
|
334
|
+
| Event | `detail` type | Description |
|
|
335
|
+
|---|---|---|
|
|
336
|
+
| `kai-select` | `CustomEvent` | The checkpoint was clicked. |
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
### `kai-choice` / `Choice`
|
|
341
|
+
|
|
342
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
343
|
+
|
|
344
|
+
| Property | Attribute | Type | Description |
|
|
345
|
+
|---|---|---|---|
|
|
346
|
+
| `data` | — | `undefined \| Record<string, unknown>` | The choice definition (the CardEnvelope.data). Set as a JS PROPERTY: `el.data = { prompt, options:[…], allowOther?, submitLabel? }`. Import `ChoiceCardData` from `@kitn.ai/ui` for the full shape. |
|
|
347
|
+
| `cardId` | `card-id` | `undefined \| string` | Stable card id correlating every emitted CardEvent. Attribute: `card-id`. |
|
|
348
|
+
| `heading` | `heading` | `undefined \| string` | Heading rendered in the card chrome (= CardEnvelope.title). Attribute: `heading`. |
|
|
349
|
+
| `resolution` | — | `undefined \| Record<string, unknown>` | Set when the user resolved this card; renders the read-only view. Property: `el.resolution = { kind:'action', action:'…' }`. |
|
|
350
|
+
|
|
351
|
+
_No events._
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
### `kai-code-block` / `CodeBlock`
|
|
356
|
+
|
|
357
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
358
|
+
|
|
359
|
+
| Property | Attribute | Type | Description |
|
|
360
|
+
|---|---|---|---|
|
|
361
|
+
| `code` | `code` | `string` | The source code to render. |
|
|
362
|
+
| `language` | `language` | `undefined \| string` | Language grammar (e.g. `js`, `python`). Defaults to `tsx`. |
|
|
363
|
+
| `codeTheme` | `code-theme` | `undefined \| string` | Shiki theme name. |
|
|
364
|
+
| `codeHighlight` | `code-highlight` | `undefined \| false \| true` | Disable syntax highlighting (renders plain text, no Shiki). |
|
|
365
|
+
| `proseSize` | `prose-size` | `undefined \| "xs" \| "sm" \| "base" \| "lg"` | Code text sizing. |
|
|
366
|
+
|
|
367
|
+
_No events._
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
### `kai-confirm` / `Confirm`
|
|
372
|
+
|
|
373
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
374
|
+
|
|
375
|
+
| Property | Attribute | Type | Description |
|
|
376
|
+
|---|---|---|---|
|
|
377
|
+
| `data` | — | `undefined \| Record<string, unknown>` | The confirm definition (the CardEnvelope.data). Set as a JS PROPERTY: `el.data = { body, tone, actions:[…] }`. Import `ConfirmCardData` from `@kitn.ai/ui` for the full shape. |
|
|
378
|
+
| `cardId` | `card-id` | `undefined \| string` | Stable card id correlating every emitted CardEvent. Attribute: `card-id`. |
|
|
379
|
+
| `heading` | `heading` | `undefined \| string` | Heading rendered in the card chrome (= CardEnvelope.title). Attribute: `heading`. |
|
|
380
|
+
| `autofocus` | `autofocus` | `undefined \| false \| true` | Focus the default action on mount (off by default — no focus-stealing). Attribute: `autofocus`. |
|
|
381
|
+
| `resolution` | — | `undefined \| Record<string, unknown>` | Set when the user resolved this card; renders the read-only view. Property: `el.resolution = { kind:'action', action:'…' }`. |
|
|
382
|
+
|
|
383
|
+
_No events._
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
### `kai-context` / `Context`
|
|
388
|
+
|
|
389
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
390
|
+
|
|
391
|
+
| Property | Attribute | Type | Description |
|
|
392
|
+
|---|---|---|---|
|
|
393
|
+
| `context` | — | `undefined \| { usedTokens: number; maxTokens: number; inputTokens?: undefined \| number; outputTokens?: undefined \| number; reasoningTokens?: undefined \| number; cacheTokens?: undefined \| number; estimatedCost?: undefined \| number }` | Token-usage data. Set as a JS property. |
|
|
394
|
+
| `warnThreshold` | `warn-threshold` | `undefined \| number` | Fraction (0–1) above which the meter turns yellow. Defaults to `0.7` (70%). |
|
|
395
|
+
| `dangerThreshold` | `danger-threshold` | `undefined \| number` | Fraction (0–1) above which the meter turns red. Defaults to `0.9` (90%). |
|
|
396
|
+
|
|
397
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
398
|
+
|
|
399
|
+
| Event | `detail` type | Description |
|
|
400
|
+
|---|---|---|
|
|
401
|
+
| `kai-threshold-change` | `CustomEvent<{ level: "ok" \| "warn" \| "danger" }>` | Fires when the computed severity level changes (ok → warn → danger or back). `detail.level` is `'ok'`, `'warn'`, or `'danger'`. |
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
### `kai-conversations` / `Conversations`
|
|
406
|
+
|
|
407
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
408
|
+
|
|
409
|
+
| Property | Attribute | Type | Description |
|
|
410
|
+
|---|---|---|---|
|
|
411
|
+
| `groups` | — | `{ id: string; userId?: undefined \| string; teamId?: undefined \| string; name: string; sortOrder: number; createdAt: string }[]` | Pre-bucketed conversation groups (e.g. "Today", "Yesterday"), each with its own conversations. Use this when you want to control the grouping/headers yourself; otherwise pass a flat `conversations` array. Set as a JS property. |
|
|
412
|
+
| `conversations` | — | `{ id: string; title: string; groupId?: undefined \| string; scope: { type: "document" \| "collection"; documentId?: undefined \| string; filters?: undefined \| { tags?: undefined \| string[]; authors?: undefined \| string[]; contentType?: undefined \| "transcript" \| "markdown"; dateRange?: undefined \| { from: string; to: string } } }; messageCount: number; lastMessageAt: string; updatedAt: string }[]` | A flat list of conversation summaries; the component buckets them by recency for you. Ignored when `groups` is provided. Set as a JS property. |
|
|
413
|
+
| `activeId` | `active-id` | `undefined \| string` | The id of the currently-open conversation, highlighted in the list. |
|
|
414
|
+
|
|
415
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
416
|
+
|
|
417
|
+
| Event | `detail` type | Description |
|
|
418
|
+
|---|---|---|
|
|
419
|
+
| `kai-conversation-select` | `CustomEvent<{ id: string }>` | A conversation was selected. |
|
|
420
|
+
| `kai-new-chat` | `CustomEvent<Record<string, never>>` | The "New chat" button was clicked. |
|
|
421
|
+
| `kai-toggle-sidebar` | `CustomEvent<Record<string, never>>` | The sidebar toggle was clicked. |
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
### `kai-embed` / `Embed`
|
|
426
|
+
|
|
427
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
428
|
+
|
|
429
|
+
| Property | Attribute | Type | Description |
|
|
430
|
+
|---|---|---|---|
|
|
431
|
+
| `cardId` | `card-id` | `undefined \| string` | Stable card id correlating every emitted event. Set as an attribute or property. |
|
|
432
|
+
| `data` | — | `undefined \| { provider: "youtube" \| "vimeo" \| "generic"; id?: undefined \| string; url?: undefined \| string; title?: undefined \| string; poster?: undefined \| string; start?: undefined \| number; aspectRatio?: undefined \| "16:9" \| "4:3" \| "1:1" \| "9:16" }` | The embed payload (provider + id/url + options). Set as a JS **property** (object). |
|
|
433
|
+
|
|
434
|
+
_No events._
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
### `kai-empty` / `Empty`
|
|
439
|
+
|
|
440
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
441
|
+
|
|
442
|
+
| Property | Attribute | Type | Description |
|
|
443
|
+
|---|---|---|---|
|
|
444
|
+
| `emptyTitle` | `empty-title` | `undefined \| string` | Title text. Attribute: `empty-title` (`title` is a global HTML attribute). |
|
|
445
|
+
| `description` | `description` | `undefined \| string` | Description text. |
|
|
446
|
+
|
|
447
|
+
_No events._
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
### `kai-feedback-bar` / `FeedbackBar`
|
|
452
|
+
|
|
453
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
454
|
+
|
|
455
|
+
| Property | Attribute | Type | Description |
|
|
456
|
+
|---|---|---|---|
|
|
457
|
+
| `barTitle` | `bar-title` | `undefined \| string` | The banner label (e.g. "Was this helpful?"). Attribute: `bar-title` (`title` is avoided — it's a global HTML attribute). |
|
|
458
|
+
| `collectDetail` | `collect-detail` | `undefined \| false \| true` | When set, a not-helpful vote opens an optional detail form before the thank-you confirmation. Attribute: `collect-detail`. |
|
|
459
|
+
| `categories` | — | `undefined \| string[]` | Optional category chips for the detail form. Set as a JS property (array). |
|
|
460
|
+
| `detailTitle` | `detail-title` | `undefined \| string` | Heading for the detail form. Attribute: `detail-title`. |
|
|
461
|
+
| `detailPlaceholder` | `detail-placeholder` | `undefined \| string` | Placeholder for the detail comment box. Attribute: `detail-placeholder`. |
|
|
462
|
+
| `submitLabel` | `submit-label` | `undefined \| string` | Submit button label in the detail form. Attribute: `submit-label`. |
|
|
463
|
+
| `thanksMessage` | `thanks-message` | `undefined \| string` | Confirmation copy shown after a vote/submit. Attribute: `thanks-message`. |
|
|
464
|
+
|
|
465
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
466
|
+
|
|
467
|
+
| Event | `detail` type | Description |
|
|
468
|
+
|---|---|---|
|
|
469
|
+
| `kai-close` | `CustomEvent` | The user dismissed the banner. |
|
|
470
|
+
| `kai-feedback` | `CustomEvent<{ value: "helpful" \| "not-helpful" }>` | The user rated the response. `value` is `'helpful'` or `'not-helpful'`. |
|
|
471
|
+
| `kai-feedback-detail` | `CustomEvent<{ value: "helpful" \| "not-helpful"; category?: undefined \| string; comment?: undefined \| string }>` | The user submitted the optional detail form (`collect-detail`). |
|
|
472
|
+
|
|
473
|
+
---
|
|
474
|
+
|
|
475
|
+
### `kai-file-tree` / `FileTree`
|
|
476
|
+
|
|
477
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
478
|
+
|
|
479
|
+
| Property | Attribute | Type | Description |
|
|
480
|
+
|---|---|---|---|
|
|
481
|
+
| `files` | — | `{ path: string; url?: undefined \| string; code?: undefined \| string; language?: undefined \| string; type?: undefined \| "html" \| "pdf" \| "image" \| "other" }[]` | The files to render. Set as a JS property (array of `{ path, url?, code?, language?, type? }`). |
|
|
482
|
+
| `activeFile` | `active-file` | `undefined \| string` | Selected file path — highlighted in the tree. |
|
|
483
|
+
| `defaultExpanded` | — | `undefined \| string[]` | Folder paths expanded initially. Omit to start with all folders open. |
|
|
484
|
+
|
|
485
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
486
|
+
|
|
487
|
+
| Event | `detail` type | Description |
|
|
488
|
+
|---|---|---|
|
|
489
|
+
| `kai-select` | `CustomEvent<{ path: string }>` | Fired when a file is selected. `detail.path` = the file's path. |
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
### `kai-file-upload` / `FileUpload`
|
|
494
|
+
|
|
495
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
496
|
+
|
|
497
|
+
| Property | Attribute | Type | Description |
|
|
498
|
+
|---|---|---|---|
|
|
499
|
+
| `multiple` | `multiple` | `undefined \| false \| true` | Allow selecting multiple files (default true). |
|
|
500
|
+
| `accept` | `accept` | `undefined \| string` | `accept` attribute for the file picker (e.g. `image/*`). |
|
|
501
|
+
| `disabled` | `disabled` | `undefined \| false \| true` | Disable the dropzone — no clicking, no drag-and-drop. |
|
|
502
|
+
| `label` | `label` | `undefined \| string` | Default dropzone label (overridable via the default slot). |
|
|
503
|
+
|
|
504
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
505
|
+
|
|
506
|
+
| Event | `detail` type | Description |
|
|
507
|
+
|---|---|---|
|
|
508
|
+
| `kai-files-added` | `CustomEvent<{ files: File[] }>` | Files were picked or dropped. |
|
|
509
|
+
|
|
510
|
+
---
|
|
511
|
+
|
|
512
|
+
### `kai-form` / `Form`
|
|
513
|
+
|
|
514
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
515
|
+
|
|
516
|
+
| Property | Attribute | Type | Description |
|
|
517
|
+
|---|---|---|---|
|
|
518
|
+
| `data` | — | `undefined \| Record<string, unknown>` | The form definition — a JSON Schema (`type:'object'`) + `x-kai-*` UI hints (the CardEnvelope.data). Set as a JS PROPERTY: `el.data = { type:'object', properties:{…} }`. Import the `FormDefinition` type from `@kitn.ai/ui` for the full shape (it is self-referential, so the element types it loosely). |
|
|
519
|
+
| `cardId` | `card-id` | `undefined \| string` | Stable card id correlating every emitted CardEvent. Attribute: `card-id`. |
|
|
520
|
+
| `heading` | `heading` | `undefined \| string` | Heading rendered in the card chrome (= CardEnvelope.title). Attribute: `heading`. |
|
|
521
|
+
| `resolution` | — | `undefined \| Record<string, unknown>` | Set when the user resolved this card; renders the read-only view. Property: `el.resolution = { kind:'submit', data:{…} }`. |
|
|
522
|
+
|
|
523
|
+
_No events._
|
|
524
|
+
|
|
525
|
+
---
|
|
526
|
+
|
|
527
|
+
### `kai-image` / `Image`
|
|
528
|
+
|
|
529
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
530
|
+
|
|
531
|
+
| Property | Attribute | Type | Description |
|
|
532
|
+
|---|---|---|---|
|
|
533
|
+
| `base64` | `base64` | `undefined \| string` | Base64-encoded image data (pair with `media-type`). |
|
|
534
|
+
| `bytes` | — | `undefined \| Uint8Array<ArrayBufferLike>` | Raw image bytes (set as a JS property). |
|
|
535
|
+
| `alt` | `alt` | `undefined \| string` | Alt text. |
|
|
536
|
+
| `mediaType` | `media-type` | `undefined \| string` | MIME type (default `image/png`). |
|
|
537
|
+
|
|
538
|
+
_No events._
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
### `kai-link-preview` / `LinkPreview`
|
|
543
|
+
|
|
544
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
545
|
+
|
|
546
|
+
| Property | Attribute | Type | Description |
|
|
547
|
+
|---|---|---|---|
|
|
548
|
+
| `cardId` | `card-id` | `undefined \| string` | Stable card id correlating every emitted event. Set as an attribute or property. |
|
|
549
|
+
| `data` | — | `undefined \| { url: string; title?: undefined \| string; description?: undefined \| string; image?: undefined \| string; imageAlt?: undefined \| string; favicon?: undefined \| string; domain?: undefined \| string; siteName?: undefined \| string }` | The link payload (OG metadata). Set as a JS **property** (object). |
|
|
550
|
+
|
|
551
|
+
_No events._
|
|
552
|
+
|
|
553
|
+
---
|
|
554
|
+
|
|
555
|
+
### `kai-loader` / `Loader`
|
|
556
|
+
|
|
557
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
558
|
+
|
|
559
|
+
| Property | Attribute | Type | Description |
|
|
560
|
+
|---|---|---|---|
|
|
561
|
+
| `variant` | `variant` | `undefined \| "circular" \| "classic" \| "pulse" \| "pulse-dot" \| "dots" \| "typing" \| "wave" \| "bars" \| "terminal" \| "text-blink" \| "text-shimmer" \| "loading-dots"` | The animation style: `'circular' \| 'classic' \| 'pulse' \| 'pulse-dot' \| 'dots' \| 'typing' \| 'wave' \| 'bars' \| 'terminal' \| 'text-blink' \| 'text-shimmer' \| 'loading-dots'`. Defaults to `'circular'`. |
|
|
562
|
+
| `size` | `size` | `undefined \| "sm" \| "lg" \| "md"` | Loader size: `'sm' \| 'md' \| 'lg'`. Defaults to `'md'`. |
|
|
563
|
+
| `text` | `text` | `undefined \| string` | Label for the text-based variants. |
|
|
564
|
+
|
|
565
|
+
_No events._
|
|
566
|
+
|
|
567
|
+
---
|
|
568
|
+
|
|
569
|
+
### `kai-markdown` / `Markdown`
|
|
570
|
+
|
|
571
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
572
|
+
|
|
573
|
+
| Property | Attribute | Type | Description |
|
|
574
|
+
|---|---|---|---|
|
|
575
|
+
| `content` | `content` | `string` | The markdown source to render. |
|
|
576
|
+
| `proseSize` | `prose-size` | `undefined \| "xs" \| "sm" \| "base" \| "lg"` | Text/markdown sizing. |
|
|
577
|
+
| `codeTheme` | `code-theme` | `undefined \| string` | Shiki theme for fenced code blocks. |
|
|
578
|
+
| `codeHighlight` | `code-highlight` | `undefined \| false \| true` | Disable syntax highlighting (no Shiki loads). |
|
|
579
|
+
|
|
580
|
+
_No events._
|
|
581
|
+
|
|
582
|
+
---
|
|
583
|
+
|
|
584
|
+
### `kai-message` / `Message`
|
|
585
|
+
|
|
586
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
587
|
+
|
|
588
|
+
| Property | Attribute | Type | Description |
|
|
589
|
+
|---|---|---|---|
|
|
590
|
+
| `message` | — | `undefined \| { id: string; role: "user" \| "assistant"; content: string; reasoning?: undefined \| { text: string; label?: undefined \| string }; tools?: undefined \| { type: string; state: "input-streaming" \| "input-available" \| "output-available" \| "output-error"; input?: undefined \| Record<string, unknown>; output?: undefined \| Record<string, unknown>; toolCallId?: undefined \| string; errorText?: undefined \| string }[]; attachments?: undefined \| { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[]; actions?: undefined \| ("copy" \| "like" \| "dislike" \| "regenerate" \| "edit" \| { id: string; label: string; icon?: undefined \| string; tooltip?: undefined \| string })[]; avatar?: undefined \| { src?: undefined \| string; fallback?: undefined \| string; alt?: undefined \| string } }` | The full message object. Set as a JS property. |
|
|
591
|
+
| `role` | `role` | `undefined \| "user" \| "assistant"` | Convenience for simple cases when not passing a `message` object. |
|
|
592
|
+
| `content` | `content` | `undefined \| string` | Convenience content (used when `message` is not set). |
|
|
593
|
+
| `markdown` | `markdown` | `undefined \| false \| true` | Force markdown on/off. Defaults to on for assistant, off for user. |
|
|
594
|
+
| `proseSize` | `prose-size` | `undefined \| "xs" \| "sm" \| "base" \| "lg"` | Text/markdown sizing for the message body. |
|
|
595
|
+
| `codeTheme` | `code-theme` | `undefined \| string` | Shiki theme name used for fenced code blocks in the content. |
|
|
596
|
+
| `codeHighlight` | `code-highlight` | `undefined \| false \| true` | Disable syntax highlighting for code blocks (no Shiki loads). |
|
|
597
|
+
| `actionsReveal` | `actions-reveal` | `undefined \| "always" \| "hover"` | Whether the action bar is always visible (`'always'`, default) or only revealed on hover of the message row (`'hover'`). |
|
|
598
|
+
| `avatarSrc` | `avatar-src` | `undefined \| string` | Convenience avatar image URL (used when `message.avatar` is not set). |
|
|
599
|
+
| `avatarFallback` | `avatar-fallback` | `undefined \| string` | Convenience avatar fallback text (used when `message.avatar` is not set). |
|
|
600
|
+
|
|
601
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
602
|
+
|
|
603
|
+
| Event | `detail` type | Description |
|
|
604
|
+
|---|---|---|
|
|
605
|
+
| `kai-message-action` | `CustomEvent<{ messageId: string; action: string }>` | An action button was clicked. `action` is the built-in name or custom id. |
|
|
606
|
+
|
|
607
|
+
---
|
|
608
|
+
|
|
609
|
+
### `kai-model-switcher` / `ModelSwitcher`
|
|
610
|
+
|
|
611
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
612
|
+
|
|
613
|
+
| Property | Attribute | Type | Description |
|
|
614
|
+
|---|---|---|---|
|
|
615
|
+
| `models` | — | `{ id: string; name: string; provider?: undefined \| string; description?: undefined \| string; group?: undefined \| string }[]` | The selectable models. Set as a JS property (array). |
|
|
616
|
+
| `currentModel` | `current-model` | `undefined \| string` | The currently-selected model id. Defaults to the first model. |
|
|
617
|
+
|
|
618
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
619
|
+
|
|
620
|
+
| Event | `detail` type | Description |
|
|
621
|
+
|---|---|---|
|
|
622
|
+
| `kai-model-change` | `CustomEvent<{ modelId: string }>` | A model was selected. |
|
|
623
|
+
|
|
624
|
+
---
|
|
625
|
+
|
|
626
|
+
### `kai-popover` / `Popover`
|
|
627
|
+
|
|
628
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
629
|
+
|
|
630
|
+
| Property | Attribute | Type | Description |
|
|
631
|
+
|---|---|---|---|
|
|
632
|
+
| `placement` | `placement` | `undefined \| "top" \| "right" \| "bottom" \| "left" \| "top-start" \| "top-end" \| "right-start" \| "right-end" \| "bottom-start" \| "bottom-end" \| "left-start" \| "left-end"` | Floating placement relative to the trigger (floating-ui placement). |
|
|
633
|
+
| `gutter` | `gutter` | `undefined \| number` | Gap in px between the trigger and the panel. |
|
|
634
|
+
| `open` | `open` | `undefined \| false \| true` | Controlled open state. Set as a JS property (`el.open = true`) to drive the popover from your app; omit for the default click-to-toggle behaviour. |
|
|
635
|
+
|
|
636
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
637
|
+
|
|
638
|
+
| Event | `detail` type | Description |
|
|
639
|
+
|---|---|---|
|
|
640
|
+
| `kai-open-change` | `CustomEvent<{ open: false \| true }>` | The popover wants to open or close (click, Escape, or outside-click). |
|
|
641
|
+
|
|
642
|
+
---
|
|
643
|
+
|
|
644
|
+
### `kai-prompt-input` / `PromptInput`
|
|
645
|
+
|
|
646
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
647
|
+
|
|
648
|
+
| Property | Attribute | Type | Description |
|
|
649
|
+
|---|---|---|---|
|
|
650
|
+
| `value` | `value` | `undefined \| string` | Controlled value of the input. When set, the host owns the text and must update it on `kai-value-change`; leave unset for uncontrolled behavior. |
|
|
651
|
+
| `placeholder` | `placeholder` | `undefined \| string` | Placeholder text shown in the empty input. |
|
|
652
|
+
| `disabled` | `disabled` | `undefined \| false \| true` | Disable the input and submit button entirely (non-interactive). |
|
|
653
|
+
| `loading` | `loading` | `undefined \| false \| true` | Show the loading/streaming state and block submit (use while awaiting a reply). |
|
|
654
|
+
| `suggestions` | — | `undefined \| string[]` | Starter prompts shown above the input. Clicking one follows `suggestionMode`. Set as a JS property. |
|
|
655
|
+
| `suggestionMode` | `suggestion-mode` | `undefined \| "submit" \| "fill"` | What clicking a suggestion does: `'submit'` (default) sends it immediately as if typed and submitted; `'fill'` just places it in the input. |
|
|
656
|
+
| `slashCommands` | — | `undefined \| { id: string; label: string; description?: undefined \| string; category?: undefined \| string }[]` | Slash commands — when set, typing `/` opens the command palette. Set as a JS property. |
|
|
657
|
+
| `slashActiveIds` | — | `undefined \| string[]` | Command ids to highlight as active. |
|
|
658
|
+
| `slashCompact` | `slash-compact` | `undefined \| false \| true` | Single-line palette rows. |
|
|
659
|
+
| `search` | `search` | `undefined \| false \| true` | Show a Search (Globe) button in the left toolbar; clicking it fires a `search` event. |
|
|
660
|
+
| `voice` | `voice` | `undefined \| false \| true` | Show a Voice (Mic) button in the left toolbar; clicking it fires a `voice` event. |
|
|
661
|
+
| `stoppable` | `stoppable` | `undefined \| false \| true` | When set and `loading` is true, the send button is replaced by a Stop button (square icon, "Stop" aria-label). Clicking it fires `kai-stop`. |
|
|
662
|
+
| `attachments` | — | `undefined \| { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[]` | Attachments to seed the input with (so a consumer can pre-populate staged files without an upload). Set as a JS property; the element then manages its own attachment state from there (add via the paperclip, remove per chip). |
|
|
663
|
+
|
|
664
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
665
|
+
|
|
666
|
+
| Event | `detail` type | Description |
|
|
667
|
+
|---|---|---|
|
|
668
|
+
| `kai-search` | `CustomEvent<Record<string, never>>` | The Search (Globe) toolbar button was clicked. |
|
|
669
|
+
| `kai-slash-select` | `CustomEvent<{ command: { id: string; label: string; description?: undefined \| string; category?: undefined \| string } }>` | A slash command was chosen from the palette. |
|
|
670
|
+
| `kai-stop` | `CustomEvent<Record<string, never>>` | The Stop button was clicked while `stoppable` and `loading` are both true. |
|
|
671
|
+
| `kai-submit` | `CustomEvent<{ value: string; attachments: { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[] }>` | The user submitted the prompt (Enter or send button) with its attachments. |
|
|
672
|
+
| `kai-suggestion-click` | `CustomEvent<{ value: string }>` | A suggestion was clicked while `suggestion-mode="fill"`. |
|
|
673
|
+
| `kai-toolbar-action` | `CustomEvent<{ action: string }>` | A custom `<kai-action>` toolbar button was clicked. `action` is the `id` of the `<kai-action>` element that was clicked. |
|
|
674
|
+
| `kai-value-change` | `CustomEvent<{ value: string }>` | The input text changed (fires on every keystroke). |
|
|
675
|
+
| `kai-voice` | `CustomEvent<Record<string, never>>` | The Voice (Mic) toolbar button was clicked. |
|
|
676
|
+
|
|
677
|
+
---
|
|
678
|
+
|
|
679
|
+
### `kai-reasoning` / `Reasoning`
|
|
680
|
+
|
|
681
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
682
|
+
|
|
683
|
+
| Property | Attribute | Type | Description |
|
|
684
|
+
|---|---|---|---|
|
|
685
|
+
| `text` | `text` | `string` | The reasoning text to display. |
|
|
686
|
+
| `label` | `label` | `undefined \| string` | Trigger label. |
|
|
687
|
+
| `open` | `open` | `undefined \| false \| true` | Controlled open state — set as a property (`el.open = true`). Omit for uncontrolled (the trigger toggles it). |
|
|
688
|
+
| `streaming` | `streaming` | `undefined \| false \| true` | While true, auto-expands (and re-collapses when it flips false). |
|
|
689
|
+
| `markdown` | `markdown` | `undefined \| false \| true` | Render `text` as markdown. |
|
|
690
|
+
|
|
691
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
692
|
+
|
|
693
|
+
| Event | `detail` type | Description |
|
|
694
|
+
|---|---|---|
|
|
695
|
+
| `kai-open-change` | `CustomEvent<{ open: false \| true }>` | Open state changed (via the trigger or streaming auto-open). |
|
|
696
|
+
|
|
697
|
+
---
|
|
698
|
+
|
|
699
|
+
### `kai-remote` / `Remote`
|
|
700
|
+
|
|
701
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
702
|
+
|
|
703
|
+
| Property | Attribute | Type | Description |
|
|
704
|
+
|---|---|---|---|
|
|
705
|
+
| `src` | `src` | `undefined \| string` | The remote card URL. Attribute: `src`. |
|
|
706
|
+
| `providerOrigin` | `provider-origin` | `undefined \| string` | Exact provider origin (https: or http://localhost for dev). Attribute: `provider-origin`. |
|
|
707
|
+
| `envelope` | — | `undefined \| Record<string, unknown>` | The card envelope to render. JS property only. |
|
|
708
|
+
| `policy` | — | `undefined \| Record<string, unknown>` | Optional routing policy. JS property only. |
|
|
709
|
+
|
|
710
|
+
_No events._
|
|
711
|
+
|
|
712
|
+
---
|
|
713
|
+
|
|
714
|
+
### `kai-resizable` / `Resizable`
|
|
715
|
+
|
|
716
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
717
|
+
|
|
718
|
+
| Property | Attribute | Type | Description |
|
|
719
|
+
|---|---|---|---|
|
|
720
|
+
| `orientation` | `orientation` | `undefined \| "horizontal" \| "vertical"` | Layout axis: `horizontal` (row, default) or `vertical` (column). |
|
|
721
|
+
| `maximizedIndex` | — | `undefined \| null \| number` | Which item index is maximized (null = none). Declarative source of truth. |
|
|
722
|
+
|
|
723
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
724
|
+
|
|
725
|
+
| Event | `detail` type | Description |
|
|
726
|
+
|---|---|---|
|
|
727
|
+
| `kai-change` | `CustomEvent<{ sizes: number[] }>` | Fired on drag-end / keyboard resize / visibility change. `detail.sizes` = panel sizes in percent. |
|
|
728
|
+
| `kai-maximize-change` | `CustomEvent<{ maximized: false \| true; index: null \| number }>` | Observe layout maximize state. |
|
|
729
|
+
|
|
730
|
+
---
|
|
731
|
+
|
|
732
|
+
### `kai-resizable-item` / `ResizableItem`
|
|
733
|
+
|
|
734
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
735
|
+
|
|
736
|
+
| Property | Attribute | Type | Description |
|
|
737
|
+
|---|---|---|---|
|
|
738
|
+
| `size` | `size` | `undefined \| string` | Initial main-axis size: `"280px"` (fixed) or `"25%"`/`25` (percent). Omitted → flexible. |
|
|
739
|
+
| `min` | `min` | `undefined \| string` | Minimum size during resize (px or %). |
|
|
740
|
+
| `max` | `max` | `undefined \| string` | Maximum size during resize (px or %). |
|
|
741
|
+
| `locked` | `locked` | `undefined \| false \| true` | Fix this panel's size; adjacent dividers become non-draggable. |
|
|
742
|
+
| `hidden` | `hidden` | `undefined \| false \| true` | Hide this panel; its divider is dropped and the rest reflow. |
|
|
743
|
+
|
|
744
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
745
|
+
|
|
746
|
+
| Event | `detail` type | Description |
|
|
747
|
+
|---|---|---|
|
|
748
|
+
| `kai-change` | `CustomEvent<unknown>` | |
|
|
749
|
+
| `kai-maximize-change` | `CustomEvent<unknown>` | |
|
|
750
|
+
|
|
751
|
+
---
|
|
752
|
+
|
|
753
|
+
### `kai-response-stream` / `ResponseStream`
|
|
754
|
+
|
|
755
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
756
|
+
|
|
757
|
+
| Property | Attribute | Type | Description |
|
|
758
|
+
|---|---|---|---|
|
|
759
|
+
| `text` | — | `undefined \| string \| AsyncIterable<string>` | Text to stream. A string, or an `AsyncIterable<string>` (set as a JS property — async iterables can't be HTML attributes). |
|
|
760
|
+
| `mode` | `mode` | `undefined \| "typewriter" \| "fade"` | Reveal animation. |
|
|
761
|
+
| `speed` | `speed` | `undefined \| number` | Characters/segments per tick. |
|
|
762
|
+
| `as` | `as` | `undefined \| string` | Element tag to render as. |
|
|
763
|
+
|
|
764
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
765
|
+
|
|
766
|
+
| Event | `detail` type | Description |
|
|
767
|
+
|---|---|---|
|
|
768
|
+
| `kai-complete` | `CustomEvent` | Streaming finished. |
|
|
769
|
+
|
|
770
|
+
---
|
|
771
|
+
|
|
772
|
+
### `kai-scope-picker` / `ScopePicker`
|
|
773
|
+
|
|
774
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
775
|
+
|
|
776
|
+
| Property | Attribute | Type | Description |
|
|
777
|
+
|---|---|---|---|
|
|
778
|
+
| `availableAuthors` | — | `string[]` | Authors to offer as scope filters. Set as a JS property. |
|
|
779
|
+
| `availableTags` | — | `string[]` | Tags to offer as scope filters. Set as a JS property. |
|
|
780
|
+
| `currentLabel` | `current-label` | `undefined \| string` | The label shown on the trigger for the active scope. |
|
|
781
|
+
|
|
782
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
783
|
+
|
|
784
|
+
| Event | `detail` type | Description |
|
|
785
|
+
|---|---|---|
|
|
786
|
+
| `kai-scope-change` | `CustomEvent<{ filters: undefined \| { tags?: undefined \| string[]; authors?: undefined \| string[]; contentType?: undefined \| "transcript" \| "markdown"; dateRange?: undefined \| { from: string; to: string } } }>` | A scope was chosen (`undefined` filters = "All Content"). |
|
|
787
|
+
|
|
788
|
+
---
|
|
789
|
+
|
|
790
|
+
### `kai-scroll-button` / `ScrollButton`
|
|
791
|
+
|
|
792
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
793
|
+
|
|
794
|
+
| Property | Attribute | Type | Description |
|
|
795
|
+
|---|---|---|---|
|
|
796
|
+
| `for` | `for` | `undefined \| string` | CSS id of the scroll container to control. When omitted the element walks up the DOM (outside its own shadow root) to find the nearest scrollable ancestor. Mirrors the `for` convention of `<label for="...">`. |
|
|
797
|
+
| `variant` | `variant` | `undefined \| "ghost" \| "default" \| "outline"` | Button visual variant: `'outline' \| 'ghost' \| 'default'`. Defaults to `'outline'`. |
|
|
798
|
+
| `size` | `size` | `undefined \| "sm" \| "lg" \| "md" \| "icon" \| "icon-sm"` | Button size token. Defaults to `'icon'` (square). |
|
|
799
|
+
|
|
800
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
801
|
+
|
|
802
|
+
| Event | `detail` type | Description |
|
|
803
|
+
|---|---|---|
|
|
804
|
+
| `kai-scroll` | `CustomEvent` | Emitted when the user clicks the button and `scrollToBottom()` is called. Carries no detail — consumers use it to know a manual scroll occurred. |
|
|
805
|
+
|
|
806
|
+
---
|
|
807
|
+
|
|
808
|
+
### `kai-skills` / `Skills`
|
|
809
|
+
|
|
810
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
811
|
+
|
|
812
|
+
| Property | Attribute | Type | Description |
|
|
813
|
+
|---|---|---|---|
|
|
814
|
+
| `skills` | — | `{ id: string; name: string }[]` | The active skills to badge. Set as a JS property. |
|
|
815
|
+
|
|
816
|
+
_No events._
|
|
817
|
+
|
|
818
|
+
---
|
|
819
|
+
|
|
820
|
+
### `kai-source` / `Source`
|
|
821
|
+
|
|
822
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
823
|
+
|
|
824
|
+
| Property | Attribute | Type | Description |
|
|
825
|
+
|---|---|---|---|
|
|
826
|
+
| `href` | `href` | `undefined \| string` | The URL this citation links to (the domain also seeds the default label/favicon). |
|
|
827
|
+
| `label` | `label` | `undefined \| string` | Trigger label (defaults to the domain). |
|
|
828
|
+
| `headline` | `headline` | `undefined \| string` | Hover-card headline. Attribute: `headline` (`title` is avoided — it's a global HTML attribute that reflects in a CE constructor and breaks it). |
|
|
829
|
+
| `description` | `description` | `undefined \| string` | Hover-card body text describing the source. |
|
|
830
|
+
| `showFavicon` | `show-favicon` | `undefined \| false \| true` | Show the source's favicon next to the trigger label. |
|
|
831
|
+
|
|
832
|
+
_No events._
|
|
833
|
+
|
|
834
|
+
---
|
|
835
|
+
|
|
836
|
+
### `kai-sources` / `Sources`
|
|
837
|
+
|
|
838
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
839
|
+
|
|
840
|
+
| Property | Attribute | Type | Description |
|
|
841
|
+
|---|---|---|---|
|
|
842
|
+
| `sources` | — | `{ href: string; title?: undefined \| string; description?: undefined \| string; label?: undefined \| string; showFavicon?: undefined \| false \| true }[]` | The sources to render. Set as a JS property. |
|
|
843
|
+
| `showFavicon` | `show-favicon` | `undefined \| false \| true` | Show favicons on all items (per-item `showFavicon` overrides). |
|
|
844
|
+
| `numbered` | `numbered` | `undefined \| false \| true` | When true, each citation chip is labelled with its 1-based index in the merged (prop + declarative-children) list (`[1]`, `[2]`, …) instead of the per-item `label` or domain fallback. HTML attribute: `numbered` (boolean — bare attribute or `numbered="true"`). JS property: `el.numbered = true`. |
|
|
845
|
+
|
|
846
|
+
_No events._
|
|
847
|
+
|
|
848
|
+
---
|
|
849
|
+
|
|
850
|
+
### `kai-suggestions` / `Suggestions`
|
|
851
|
+
|
|
852
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
853
|
+
|
|
854
|
+
| Property | Attribute | Type | Description |
|
|
855
|
+
|---|---|---|---|
|
|
856
|
+
| `suggestions` | — | `(string \| { label: string; value?: undefined \| string })[]` | The suggestions. Strings, or `{ label, value }` when the displayed text and the emitted value differ. Set as a JS property. |
|
|
857
|
+
| `variant` | `variant` | `undefined \| "ghost" \| "default" \| "outline"` | Chip style: `'outline'` (default), `'ghost'`, or `'default'` (filled). |
|
|
858
|
+
| `size` | `size` | `undefined \| "sm" \| "lg" \| "md" \| "icon" \| "icon-sm"` | Size preset for each chip. Defaults to the pill default (`'lg'`); pass `'sm'` for smaller pills (or `'md'`). |
|
|
859
|
+
| `block` | `block` | `undefined \| false \| true` | Full-width left-aligned rows instead of pills. |
|
|
860
|
+
| `highlight` | `highlight` | `undefined \| string` | Substring to highlight within each suggestion. |
|
|
861
|
+
|
|
862
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
863
|
+
|
|
864
|
+
| Event | `detail` type | Description |
|
|
865
|
+
|---|---|---|
|
|
866
|
+
| `kai-select` | `CustomEvent<{ value: string }>` | A suggestion was clicked. |
|
|
867
|
+
|
|
868
|
+
---
|
|
869
|
+
|
|
870
|
+
### `kai-switch` / `Switch`
|
|
871
|
+
|
|
872
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
873
|
+
|
|
874
|
+
| Property | Attribute | Type | Description |
|
|
875
|
+
|---|---|---|---|
|
|
876
|
+
| `checked` | `checked` | `undefined \| false \| true` | Initial checked state. Bare attribute (`<kai-switch checked>`) turns it on. |
|
|
877
|
+
| `disabled` | `disabled` | `undefined \| false \| true` | Disable interaction. |
|
|
878
|
+
| `label` | `label` | `undefined \| string` | Accessible label. |
|
|
879
|
+
|
|
880
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
881
|
+
|
|
882
|
+
| Event | `detail` type | Description |
|
|
883
|
+
|---|---|---|
|
|
884
|
+
| `kai-change` | `CustomEvent<{ checked: false \| true }>` | The toggle changed. |
|
|
885
|
+
|
|
886
|
+
---
|
|
887
|
+
|
|
888
|
+
### `kai-tasks` / `Tasks`
|
|
889
|
+
|
|
890
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
891
|
+
|
|
892
|
+
| Property | Attribute | Type | Description |
|
|
893
|
+
|---|---|---|---|
|
|
894
|
+
| `data` | — | `undefined \| Record<string, unknown>` | The tasks definition (the CardEnvelope.data). Set as a JS PROPERTY: `el.data = { tasks:[…], selectAll, confirmLabel, … }`. Import `TasksCardData` from `@kitn.ai/ui` for the full shape. |
|
|
895
|
+
| `cardId` | `card-id` | `undefined \| string` | Stable card id correlating every emitted CardEvent. Attribute: `card-id`. |
|
|
896
|
+
| `heading` | `heading` | `undefined \| string` | Heading rendered in the card chrome (= CardEnvelope.title). Attribute: `heading`. |
|
|
897
|
+
| `resolution` | — | `undefined \| Record<string, unknown>` | Set when the user resolved this card; renders the read-only view. Property: `el.resolution = { kind:'submit', data:{ selected:[…] } }`. |
|
|
898
|
+
|
|
899
|
+
_No events._
|
|
900
|
+
|
|
901
|
+
---
|
|
902
|
+
|
|
903
|
+
### `kai-text-shimmer` / `TextShimmer`
|
|
904
|
+
|
|
905
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
906
|
+
|
|
907
|
+
| Property | Attribute | Type | Description |
|
|
908
|
+
|---|---|---|---|
|
|
909
|
+
| `text` | `text` | `undefined \| string` | The text to shimmer. |
|
|
910
|
+
| `as` | `as` | `undefined \| string` | Element tag to render as (default `span`). |
|
|
911
|
+
| `duration` | `duration` | `undefined \| number` | Animation duration in seconds. |
|
|
912
|
+
| `spread` | `spread` | `undefined \| number` | Gradient spread (5–45). |
|
|
913
|
+
|
|
914
|
+
_No events._
|
|
915
|
+
|
|
916
|
+
---
|
|
917
|
+
|
|
918
|
+
### `kai-thinking-bar` / `ThinkingBar`
|
|
919
|
+
|
|
920
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
921
|
+
|
|
922
|
+
| Property | Attribute | Type | Description |
|
|
923
|
+
|---|---|---|---|
|
|
924
|
+
| `text` | `text` | `undefined \| string` | The shimmering label, e.g. "Thinking…". |
|
|
925
|
+
| `stoppable` | `stoppable` | `undefined \| false \| true` | When true, show a "stop" affordance that fires a `stop` event. |
|
|
926
|
+
| `stopLabel` | `stop-label` | `undefined \| string` | Label for the stop affordance. |
|
|
927
|
+
|
|
928
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
929
|
+
|
|
930
|
+
| Event | `detail` type | Description |
|
|
931
|
+
|---|---|---|
|
|
932
|
+
| `kai-stop` | `CustomEvent` | The "stop / answer now" affordance was clicked. |
|
|
933
|
+
|
|
934
|
+
---
|
|
935
|
+
|
|
936
|
+
### `kai-tool` / `Tool`
|
|
937
|
+
|
|
938
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
939
|
+
|
|
940
|
+
| Property | Attribute | Type | Description |
|
|
941
|
+
|---|---|---|---|
|
|
942
|
+
| `tool` | — | `undefined \| { type: string; state: "input-streaming" \| "input-available" \| "output-available" \| "output-error"; input?: undefined \| Record<string, unknown>; output?: undefined \| Record<string, unknown>; toolCallId?: undefined \| string; errorText?: undefined \| string }` | The tool-call to display. Set as a JS property. |
|
|
943
|
+
| `open` | `open` | `undefined \| false \| true` | Start expanded. |
|
|
944
|
+
|
|
945
|
+
_No events._
|
|
946
|
+
|
|
947
|
+
---
|
|
948
|
+
|
|
949
|
+
### `kai-voice-input` / `VoiceInput`
|
|
950
|
+
|
|
951
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
952
|
+
|
|
953
|
+
| Property | Attribute | Type | Description |
|
|
954
|
+
|---|---|---|---|
|
|
955
|
+
| `transcribe` | — | `undefined \| (audio: Blob) => Promise<string>` | Transcriber the host supplies — records audio, returns the text. This is a **function-valued property** (`el.transcribe = async blob => '...'`) because a value-returning callback can't be modelled as a fire-and-forget event. |
|
|
956
|
+
| `disabled` | `disabled` | `undefined \| false \| true` | Disable the mic button (non-interactive). |
|
|
957
|
+
|
|
958
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
959
|
+
|
|
960
|
+
| Event | `detail` type | Description |
|
|
961
|
+
|---|---|---|
|
|
962
|
+
| `kai-audio-captured` | `CustomEvent<{ blob: Blob }>` | Raw audio captured (before transcription) — for hosts that prefer to handle transcription themselves instead of via the `transcribe` property. |
|
|
963
|
+
| `kai-transcription` | `CustomEvent<{ text: string }>` | Transcription completed (the `transcribe` property resolved). |
|
|
964
|
+
|
|
965
|
+
---
|
|
966
|
+
|
|
967
|
+
### `kai-workspace` / `Workspace`
|
|
968
|
+
|
|
969
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
970
|
+
|
|
971
|
+
| Property | Attribute | Type | Description |
|
|
972
|
+
|---|---|---|---|
|
|
973
|
+
| `groups` | — | `{ id: string; userId?: undefined \| string; teamId?: undefined \| string; name: string; sortOrder: number; createdAt: string }[]` | Pre-bucketed conversation groups for the sidebar. Set as a JS property. |
|
|
974
|
+
| `conversations` | — | `{ id: string; title: string; groupId?: undefined \| string; scope: { type: "document" \| "collection"; documentId?: undefined \| string; filters?: undefined \| { tags?: undefined \| string[]; authors?: undefined \| string[]; contentType?: undefined \| "transcript" \| "markdown"; dateRange?: undefined \| { from: string; to: string } } }; messageCount: number; lastMessageAt: string; updatedAt: string }[]` | Flat conversation list (auto-bucketed if `groups` is empty). Set as a JS property. |
|
|
975
|
+
| `activeId` | `active-id` | `undefined \| string` | Id of the open conversation, highlighted in the sidebar. |
|
|
976
|
+
| `messages` | — | `{ id: string; role: "user" \| "assistant"; content: string; reasoning?: undefined \| { text: string; label?: undefined \| string }; tools?: undefined \| { type: string; state: "input-streaming" \| "input-available" \| "output-available" \| "output-error"; input?: undefined \| Record<string, unknown>; output?: undefined \| Record<string, unknown>; toolCallId?: undefined \| string; errorText?: undefined \| string }[]; attachments?: undefined \| { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[]; actions?: undefined \| ("copy" \| "like" \| "dislike" \| "regenerate" \| "edit" \| { id: string; label: string; icon?: undefined \| string; tooltip?: undefined \| string })[]; avatar?: undefined \| { src?: undefined \| string; fallback?: undefined \| string; alt?: undefined \| string } }[]` | The active conversation's message thread, newest last. Set as a JS property. |
|
|
977
|
+
| `value` | `value` | `undefined \| string` | |
|
|
978
|
+
| `placeholder` | `placeholder` | `undefined \| string` | |
|
|
979
|
+
| `loading` | `loading` | `undefined \| false \| true` | |
|
|
980
|
+
| `suggestions` | — | `undefined \| string[]` | |
|
|
981
|
+
| `suggestionMode` | `suggestion-mode` | `undefined \| "submit" \| "fill"` | |
|
|
982
|
+
| `proseSize` | `prose-size` | `undefined \| "xs" \| "sm" \| "base" \| "lg"` | |
|
|
983
|
+
| `codeTheme` | `code-theme` | `undefined \| string` | |
|
|
984
|
+
| `codeHighlight` | `code-highlight` | `undefined \| false \| true` | |
|
|
985
|
+
| `chatTitle` | `chat-title` | `undefined \| string` | |
|
|
986
|
+
| `models` | — | `undefined \| { id: string; name: string; provider?: undefined \| string; description?: undefined \| string; group?: undefined \| string }[]` | |
|
|
987
|
+
| `currentModel` | `current-model` | `undefined \| string` | |
|
|
988
|
+
| `context` | — | `undefined \| { usedTokens: number; maxTokens: number; inputTokens?: undefined \| number; outputTokens?: undefined \| number; estimatedCost?: undefined \| number }` | |
|
|
989
|
+
| `scrollButton` | `scroll-button` | `undefined \| false \| true` | |
|
|
990
|
+
| `search` | `search` | `undefined \| false \| true` | |
|
|
991
|
+
| `voice` | `voice` | `undefined \| false \| true` | |
|
|
992
|
+
| `slashCommands` | — | `undefined \| { id: string; label: string; description?: undefined \| string; category?: undefined \| string }[]` | |
|
|
993
|
+
| `slashActiveIds` | — | `undefined \| string[]` | |
|
|
994
|
+
| `slashCompact` | `slash-compact` | `undefined \| false \| true` | |
|
|
995
|
+
| `sidebarWidth` | `sidebar-width` | `undefined \| number` | Sidebar default width as a percent of the workspace (default 22). |
|
|
996
|
+
| `sidebarMinWidth` | `sidebar-min-width` | `undefined \| number` | Sidebar min width in px (default 200). |
|
|
997
|
+
| `sidebarMaxWidth` | `sidebar-max-width` | `undefined \| number` | Sidebar max width in px (default 420). |
|
|
998
|
+
| `sidebarCollapsed` | `sidebar-collapsed` | `undefined \| false \| true` | Controlled collapsed state. Set this as a JS property (`el.sidebarCollapsed = true`) to drive the sidebar from your app, updating it in response to the `kai-sidebar-toggle` event. Omit for uncontrolled (the element manages it). |
|
|
999
|
+
| `defaultSidebarCollapsed` | `default-sidebar-collapsed` | `undefined \| false \| true` | Initial collapsed state when uncontrolled (default false). Use the `default-sidebar-collapsed` attribute to start collapsed in plain HTML. |
|
|
1000
|
+
|
|
1001
|
+
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
1002
|
+
|
|
1003
|
+
| Event | `detail` type | Description |
|
|
1004
|
+
|---|---|---|
|
|
1005
|
+
| `kai-conversation-select` | `CustomEvent<{ id: string }>` | A conversation was selected in the sidebar. |
|
|
1006
|
+
| `kai-message-action` | `CustomEvent<{ messageId: string; action: string }>` | An action button on a message was clicked. |
|
|
1007
|
+
| `kai-model-change` | `CustomEvent<{ modelId: string }>` | The header model switcher changed. |
|
|
1008
|
+
| `kai-new-chat` | `CustomEvent<Record<string, never>>` | The "New chat" button was clicked. |
|
|
1009
|
+
| `kai-search` | `CustomEvent<Record<string, never>>` | The Search button was clicked. |
|
|
1010
|
+
| `kai-sidebar-toggle` | `CustomEvent<{ collapsed: false \| true }>` | The sidebar was collapsed or expanded. |
|
|
1011
|
+
| `kai-slash-select` | `CustomEvent<{ command: { id: string; label: string; description?: undefined \| string; category?: undefined \| string } }>` | A slash command was chosen from the palette. |
|
|
1012
|
+
| `kai-submit` | `CustomEvent<{ value: string; attachments: { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[] }>` | User submitted a message. |
|
|
1013
|
+
| `kai-suggestion-click` | `CustomEvent<{ value: string }>` | A suggestion chip was clicked (only in `suggestion-mode="fill"`). |
|
|
1014
|
+
| `kai-value-change` | `CustomEvent<{ value: string }>` | Fired on every input change. |
|
|
1015
|
+
| `kai-voice` | `CustomEvent<Record<string, never>>` | The Mic / voice button was clicked. |
|
|
1016
|
+
|
|
1017
|
+
---
|
|
1018
|
+
|