Composer
The prompt box: grows with what is written, then scrolls; Send, which becomes Stop while a response streams.
function Basic() {
const [streaming, setStreaming] = useState(false);
return (
<Composer
className="w-full max-w-640"
streaming={streaming}
onSubmit={() => {
setStreaming(true);
setTimeout(() => setStreaming(false), 2400);
}}
onStop={() => setStreaming(false)}
/>
);
}import { Composer } from "@logicplanes/kaeso-ui/playground";Props
actionsReactNodeControls at the start of the button row: parameters, clear.
aria-labelstringThe text box's accessible name ("Prompt" by default).
autoFocusbooleanFocuses the composer when it appears.
clearOnSubmitboolean = trueClears an uncontrolled composer after Send (true by default).
defaultValuestringThe message on first render.
disabledboolean = falseTurns it off: it can't be used, and it looks dimmed.
loadingboolean = falseThe prompt is being sent: Send shows a spinner.
maxRowsnumber = 10Lines before the text box scrolls (10 by default).
namestringThe field name the value is sent under in a form.
onStop(() => void)Stop: the button while
streaming.onSubmit((value: string) => void)Send: the Send button, Enter in the text box (see
submitOn), or ⌘ Enter (Ctrl Enter). Not called for a prompt that is empty or only spaces, while disabled, sending or streaming, or while an input method is composing.onValueChange((value: string) => void)Called with the message as it is typed.
placeholderstringText shown while there is no value.
size"md" | "sm" = mdThe composer's height.
stopLabelstringThe stop button's accessible name, shown while a reply streams.
streamingboolean = falseA response is arriving: Send becomes Stop. The text box stays editable for the next prompt.
submitLabelstringThe send button's accessible name.
submitOn"enter" | "mod-enter" = enterThe key that sends from the text box.
"enter"(default): Enter sends and Shift Enter adds a line; on a touch screen Enter adds a line and the Send button sends."mod-enter": Enter adds a line and only ⌘ Enter (Ctrl Enter) sends. ⌘ Enter and Ctrl Enter send with either.valuestringThe message being written, when you control it.