Skip to content
PixiKit

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
NameTypeDefaultDescription
valuestringNoneThe text, when you hold it.
defaultValuestring""The text at first, when the box holds it.
onValueChange(value: string) => voidNoneCalled with the text as it changes.
onSubmit(payload: ComposePayload) => void | Promise<void>NoneCalled on send. A promise keeps the box busy; a rejection keeps the text and shows an error.
placeholderstring"Write a comment"Hint shown in the empty box.
avatar{ name: string; src?: string }NoneThe author, shown beside the box.
titlebooleanfalseShows a title line above the text.
titleValuestringNoneThe title text, when you hold it.
onTitleChange(value: string) => voidNoneCalled with the title as it changes.
maxLengthnumberNoneThe most characters allowed; a count shows near it and sending is blocked past it.
minRowsnumber3The fewest rows the text area shows.
maxRowsnumber10The 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.
formattingbooleanfalseAdds Bold, Italic, Link, List and Code buttons and the Cmd or Ctrl plus B, I, K shortcuts.
previewbooleanfalseAdds Write and Preview tabs.
attachmentsbooleanfalseAdds an attach button and drag and drop of files.
acceptstringNoneThe file types allowed, as in a file input's `accept`.
maxFilesnumber5The most files that can be attached.
mentionsComposeMention[]NonePeople that typing @ can pick.
pickersComposePicker[]NonePill buttons under the text; their values go to `meta`.
submitLabelstring"Send"The text of the send button.
submitShortcutbooleantrueLets Cmd or Ctrl plus Enter send.
draftKeystringNoneSaves the text in localStorage under this key while typing and restores it.
disabledbooleanfalseTurns the box off.
classNamestringNone

Related