You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/docs/content/components/(chatbot)/prompt-input.mdx
+61Lines changed: 61 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -270,6 +270,14 @@ Buttons can display tooltips with optional keyboard shortcut hints. Hover over t
270
270
271
271
<Previewpath="prompt-input-tooltip" />
272
272
273
+
### Richtext input
274
+
275
+
`PromptInputRichtext` is an alternative text input to `PromptInputTextarea` when you want an extensible composer-style input with markdown shortcuts, autolink support, and Lexical plugins.
276
+
277
+
<Previewpath="prompt-input-richtext" />
278
+
279
+
`PromptInputRichtext` integrates with `PromptInputProvider`, so the editor content can stay in sync with external state. On submit, the rich text content is serialized back to markdown and returned as `message.text`.
280
+
273
281
## Props
274
282
275
283
### `<PromptInput />`
@@ -330,6 +338,59 @@ Buttons can display tooltips with optional keyboard shortcut hints. Hover over t
330
338
}}
331
339
/>
332
340
341
+
### `<PromptInputRichtext />`
342
+
343
+
Lexical-powered rich text input for `PromptInput`. It supports markdown import/export, URL autolinking, keyboard submit behavior, attachment paste, and custom Lexical plugins.
344
+
345
+
<TypeTable
346
+
type={{
347
+
editorConfig: {
348
+
description:
349
+
"Optional Lexical initial config merged with the default PromptInput configuration.",
350
+
type: "InitialConfigType",
351
+
},
352
+
autoFocus: {
353
+
description: "Whether to focus the editor on mount.",
354
+
type: "boolean",
355
+
default: "true",
356
+
},
357
+
onChange: {
358
+
description:
359
+
"Called when the Lexical editor state changes. In provider mode, markdown text is also synced to controller state.",
360
+
type: "(editorState: EditorState) => void",
361
+
},
362
+
onKeyDown: {
363
+
description:
364
+
"Optional keydown handler attached to the editor root element.",
365
+
type: "(event: KeyboardEvent) => void",
366
+
},
367
+
placeholder: {
368
+
description: "Placeholder text shown when the editor is empty.",
369
+
type: "string",
370
+
default: '"What would you like to know?"',
371
+
},
372
+
placeholderClassName: {
373
+
description: "Additional class names for the placeholder element.",
374
+
type: "string",
375
+
},
376
+
className: {
377
+
description: "Additional class names for the content editable element.",
378
+
type: "string",
379
+
},
380
+
children: {
381
+
description: "Optional Lexical plugins rendered inside the composer.",
382
+
type: "React.ReactNode",
383
+
},
384
+
"...props": {
385
+
description:
386
+
"Any other props are spread to the underlying Lexical `ContentEditable` element.",
`PromptInputRichtext` submits on `Enter`, inserts a newline on `Shift+Enter`, removes the last attachment with `Backspace` when empty, and converts pasted files into prompt attachments.
0 commit comments