ValyroUI English version

Inline Suggestion

Подсказка-автодополнение в поле ввода. Pro · ИИ: чат и агенты › Промпт и модели

Установка

npx valyro-cli@latest login
npx valyro-cli@latest add inline-suggestion
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { InlineSuggestion } from 'valyro-ui-pro';

Пропсы

PropTypeDefault
valuestringControlled value; use with onValueChange.
defaultValuestring''Initial value when uncontrolled.
onValueChange(value: string) => voidCalled with the new value when it changes.
getSuggestion *(text: string, request: InlineSuggestionRequest) => Promise<string | null | undefined> | string | null | undefinedReturns the completion for text (what follows the caret), or nothing. Called after the user pauses typing with the caret at the end; may be async. Errors go to onError.
debouncenumber350Pause in typing before asking, in ms.
minLengthnumber3Minimum text length before asking.
multilinebooleantrueA textarea (default) or a single-line input.
showHintbooleantrueShow the Tab key hint next to a suggestion.
defaultSuggestionstringA suggestion shown from the first render, before focus: a static preview, or a completion the app already has for defaultValue. It stays until the field loses focus, is edited or dismissed; Tab and Ctrl/⌘ → accept it like a fetched one.
onAccept(accepted: string, kind: 'all' | 'word') => voidCalled with the accepted text: all of it (Tab) or one word (Ctrl/⌘ →).
onError(error: unknown) => voidA failed getSuggestion. Without it the error is logged to the console.
refRef<HTMLTextAreaElement | HTMLInputElement>The text field: the <textarea>, or the <input> when multiline is off.
labelsPartial<InlineSuggestionLabels>Overrides for the built-in English text; keys left out keep their defaults.

Похожие компоненты

Назад: Prompt Composer · Далее: Model Selector · Весь раздел «ИИ: чат и агенты»