Compose Box
A message or comment composer with autosizing text, Markdown tools and preview, @mentions, attachments, pickers and saved drafts.
pixikit.com/docs/app-ui/forms/compose-box
Customize
Title
Max length280
Min rows3
Max rows8
Toolbar
Formatting
Preview
Attachments
Max files4
Submit shortcut
Disabled
Props
25| Name | Type | Default | Description |
|---|---|---|---|
value | string | None | The text, when you hold it. |
defaultValue | string | "" | The text at first, when the box holds it. |
onValueChange | (value: string) => void | None | Called with the text as it changes. |
onSubmit | (payload: ComposePayload) => void | Promise<void> | None | Called on send. A promise keeps the box busy; a rejection keeps the text and shows an error. |
placeholder | string | "Write a comment" | Hint shown in the empty box. |
avatar | { name: string; src?: string } | None | The author, shown beside the box. |
title | boolean | false | Shows a title line above the text. |
titleValue | string | None | The title text, when you hold it. |
onTitleChange | (value: string) => void | None | Called with the title as it changes. |
maxLength | number | None | The most characters allowed; a count shows near it and sending is blocked past it. |
minRows | number | 3 | The fewest rows the text area shows. |
maxRows | number | 10 | The most rows before the text area scrolls. |
toolbar | "inside" | "footer" | "none" | "inside" | Where the tool buttons go: above the text, in the footer, or nowhere. |
formatting | boolean | false | Adds Bold, Italic, Link, List and Code buttons and the Cmd or Ctrl plus B, I, K shortcuts. |
preview | boolean | false | Adds Write and Preview tabs. |
attachments | boolean | false | Adds an attach button and drag and drop of files. |
accept | string | None | The file types allowed, as in a file input's `accept`. |
maxFiles | number | 5 | The most files that can be attached. |
mentions | ComposeMention[] | None | People that typing @ can pick. |
pickers | ComposePicker[] | None | Pill buttons under the text; their values go to `meta`. |
submitLabel | string | "Send" | The text of the send button. |
submitShortcut | boolean | true | Lets Cmd or Ctrl plus Enter send. |
draftKey | string | None | Saves the text in localStorage under this key while typing and restores it. |
disabled | boolean | false | Turns the box off. |
className | string | None |