Prompt Bar
A glass capsule for writing to a model. It grows as you type, takes files as chips, and lights up when you drag one over it.
Needs: None. Your own send and stop calls.
Customize
size
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| onSend | (text: string, files: File[]) => void | required | Called with the trimmed text and the attached files on Enter or the send button. The bar then clears itself. |
| value | string | – | Controlled text. Leave it out and the bar keeps its own. |
| defaultValue | string | "" | Starting text when uncontrolled. |
| onChange | (value: string) => void | – | Called on every edit, and with "" after sending. |
| onStop | () => void | – | Called when stop is pressed while generating. |
| generating | boolean | false | A reply is being written: the send button morphs into stop. Typing the next message still works; Enter waits. |
| progress | number | – | 0 to 1, how far the reply has got. Draws a thin ring around stop. Leave it out when it isn't known; nothing spins. |
| placeholder | string | "Ask anything" | Shown in the empty field. |
| attachments | boolean | true | Accept pasted, dropped and picked files as chips, with an attach button for the keyboard. |
| accent | string | "#2f6fed" | Any CSS colour for the send button, caret, focus ring and drop glow. The arrow turns black or white to suit it. The default lightens in dark mode. |
| maxRows | number | 8 | How many lines the text grows to before it scrolls. |
| size | "sm" | "md" | "lg" | "md" | Type size, button size and corner radius. |
| children | ReactNode | – | The toolbar slot beside the send button: a ModelPicker, a mode toggle. |
| className | string | – | Added to the root element. |
| style | CSSProperties | – | Inline styles on the root; set --mlui-* variables here to theme it. |