Prompt composer
v0.64.0, changelogBetaWhere someone writes to a model: a form with a growing text box, Enter to send (never during IME composition), attachments, Send that becomes Stop, and disabled reasons and limits in words.
API reference
Generated from the types. Every part also takes className.
PromptComposer
- onSubmitrequired
(text: string, files: File[]) => void | booleanCalled with the trimmed text and the attached files. Return false to keep them in the box (it is cleared otherwise).- onStop
() => voidShows Stop in Send's place whilestreaming. Abort the request in it.- streaming
boolean = falseAn answer is streaming: Send becomes Stop, and Enter does not send.- disabled
boolean = falseNothing can be sent (offline, no access): say why indisabledReason.- disabledReason
stringWhy it is disabled, shown under the box.- value
stringThe text (controlled).- defaultValue
string = ""- onValueChange
(value: string) => void- allowFiles
boolean = falseShows the attach button and takes pasted and dropped files.- defaultFiles
File[]Files in the tray at first: a frame the page attaches for the person.- accept
stringSame syntax as <input accept>: "image/*,.pdf".- maxSize
numberBytes, per file.- maxFiles
number- onFilesChange
(files: File[]) => voidCalled with the files in the tray whenever it changes.- onReject
(rejections: FileRejection[]) => voidCalled with the files refused, by type, size or count. They are also named under the box.- maxLength
numberA limit on the text, in characters: shows the count, and Send says why it waits once it is passed.- maxRows
number = 8How many lines the box grows to before it scrolls. Default 8.- toolbar
ReactNodeMore controls beside the attach button: a model select, a context chip. A Select here loses its ring and fill (the box is the edge).- name
stringThe text box's name, for the form's data.- autoFocus
boolean- locale
stringFormats the counts.- labels
Partial<PromptComposerLabels>