@assistant-ui/react
Version:
Open-source TypeScript/React library for building production-grade AI chat experiences
28 lines • 1.33 kB
TypeScript
import { type KeyboardEventHandler } from "react";
/** @deprecated Experimental since 2026-06-11. Not scheduled for removal; the API may change in any release. */
export type Unstable_ComposerInputHistory = {
/** Keydown handler to spread onto `ComposerPrimitive.Input`. */
onKeyDown: KeyboardEventHandler<HTMLTextAreaElement>;
};
/**
* Terminal-style input history for the thread composer: ArrowUp on an
* empty draft recalls previously sent user messages (newest first),
* ArrowDown steps back toward the newest and finally restores the draft
* that was being typed when browsing started.
*
* Recall only triggers when the caret is on the first/last line with no
* selection, so multi-line editing keeps native arrow behavior. The
* handler yields to an open mention/slash popover, to IME composition,
* to modifier keys, and to consumer handlers that already called
* `preventDefault`. It is inert on edit composers.
*
* @deprecated Experimental since 2026-06-11. Not scheduled for removal; the API may change in any release.
*
* @example
* ```tsx
* const history = unstable_useComposerInputHistory();
* <ComposerPrimitive.Input {...history} />
* ```
*/
export declare function unstable_useComposerInputHistory(): Unstable_ComposerInputHistory;
//# sourceMappingURL=useComposerInputHistory.d.ts.map