@kitn.ai/ui
Version:
Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. Authored in SolidJS.
52 lines (51 loc) • 2.71 kB
TypeScript
import { TriggerDef, ComposerChange } from '../components/composer';
import { ComposerDoc } from '../primitives/composer-model';
import { AttachmentData } from '../components/attachments';
import { CustomAction } from './chat-types';
export interface DefaultPromptInputProps {
/** String = controlled text mirror; ComposerDoc = a seed that pre-populates pills. */
value: string | ComposerDoc;
placeholder?: string;
disabled?: boolean;
loading?: boolean;
suggestions?: string[];
/** Attachments staged in the input. Provide `onAttachmentsChange` to enable
* the attach button + removable previews. */
attachments?: AttachmentData[];
/** When `false`, the built-in paperclip attach button is hidden even if
* `onAttachmentsChange` is provided (e.g. when a `+` menu already covers
* file-attach). Defaults to `true`. */
attach?: boolean;
/** Show a Search (Globe) button in the left toolbar; calls `onSearch`. */
search?: boolean;
/** Show a Voice (Mic) button in the left toolbar; calls `onVoice`. */
voice?: boolean;
/** Send-button visibility. `'always'` (default) always shows it; `'auto'` shows
* it only when there's text/attachments (an empty composer hides it — Enter
* still submits). To hide it entirely (Enter-only), it's pure CSS:
* `::part(send){display:none}` — no prop needed. Restyle via `::part(send)`.
* The Stop button (stoppable + loading) is unaffected. */
submit?: 'always' | 'auto';
onValueChange: (v: string) => void;
onSubmit: () => void;
onSuggestionClick: (v: string) => void;
onAttachmentsChange?: (attachments: AttachmentData[]) => void;
onSearch?: () => void;
onVoice?: () => void;
/** When `true` and `loading` is also `true`, the send button is replaced by
* a Stop button that calls `onStop`. */
stoppable?: boolean;
/** Called when the user clicks the Stop button. */
onStop?: () => void;
/** Custom toolbar action buttons declared as `<kai-action>` light-DOM children. */
toolbarActions?: CustomAction[];
/** Called when a custom toolbar action button is clicked, with the action id. */
onAction?: (id: string) => void;
/** Rich entity triggers (`/` skills, `@` agents) passed to the composer. */
triggers?: TriggerDef[];
/** Default icon per entity kind (kind → image src) passed to the composer. */
kindIcons?: Record<string, string>;
/** Structured change (doc + entities) from the composer, on every edit. */
onComposerChange?: (change: ComposerChange) => void;
}
export declare function DefaultPromptInput(props: DefaultPromptInputProps): import("solid-js").JSX.Element;