Composer
The message box for a chat: a text field that becomes a Tiptap editor on demand, file attachments, and send that turns into stop.
When to use
- Use when
- The message box of a chat: send on Enter, attach files by drop, paste, or picker, and stop a reply in progress.
- Avoid when
- A single-line field for short answers; use Input.
Installation
The source lands in src/components/ui/composer.tsx, along with any Shelf items it builds on, and .shelf/lock.json records what was installed. It's yours to edit.
Usage
Built on
- Packages
@stylexjs/stylex,@tiptap/core,@tiptap/extension-document,@tiptap/extension-hard-break,@tiptap/extension-paragraph,@tiptap/extension-text,@tiptap/extensions,@tiptap/pm,@tiptap/react- Shelf items
- Attachment, Button, Dropzone, Editor suggestion,
foundations, Icons, Message,utils - Figma
- Optional native Figma library. See Designers.
Verified
- Size
- 5.6 kB gzipped on its own, 132 kB with the Shelf items and packages it builds on. JS and CSS in a production build, without React.
- Accessibility
- Axe passes on 7 stories
- Behavior
- 7 interaction tests in Storybook
- Rendering
- Parent re-renders skip its consumers
- React Doctor
- React Doctor finds nothing