Prompt Area
A production-grade rich text input for AI chat interfaces
A contentEditable textarea with @mentions, /commands, #tags, inline markdown, file attachments, undo/redo, and dark mode. Built as a shadcn registry component — install with one command, zero extra dependencies.
What is Prompt Area?
Most textarea components handle plain text. When you need structured input — mentions, slash commands, tags — you end up stitching together multiple libraries or building from scratch on top of a heavy editor framework like ProseMirror or Slate.
Prompt Area is a single contentEditable-based React component that gives you trigger-based chips, inline markdown formatting, file attachments, and structured data extraction — all in one package with no external editor dependencies.
Built specifically for AI and LLM chat interfaces, where inputs need to be richer than a plain textarea but lighter than a full document editor. Install it with one command from the shadcn registry and start using it immediately.
Try editing, type @ to mention, / for commands, or just hit Enter
Why Prompt Area?
One component, not five
Instead of combining a mention library, command palette, tag input, markdown editor, and file upload widget, Prompt Area handles all of these in a single component with a unified API.
Zero extra dependencies
Ships as a shadcn registry component. Your bundle only grows by the component code itself — no ProseMirror, no TipTap, no Slate. Just React and the DOM.
Structured data out of the box
Every chip, mention, and tag is a typed segment. Call getChipsByTrigger("@") to extract structured data without parsing HTML. The submit callback gives you clean, typed output ready for your API.
Built for AI chat
Designed from the ground up for LLM prompt interfaces. Action Bar, Status Bar, Compact Prompt Area, and Chat Prompt Layout are all first-class companion components that install independently.
How It Works
Install via shadcn CLI
One command adds the component to your project. No config files, no provider wrappers, no extra dependencies.
Define your triggers
Pass an array of trigger configs — @ for mentions, / for commands, # for tags. Each trigger specifies its search behavior, item list, and resolve logic.
Get structured output
On submit, Prompt Area returns typed segments — plain text, chips with metadata, markdown spans. Use helper functions like getChipsByTrigger("@") to extract exactly what you need.
Installation
Install individual components via the shadcn CLI, or use the AI agent prompt to set everything up in one go.
Core rich text input with triggers, markdown, and attachments
Copy this prompt and give it to your AI coding agent to install and set up the component in a single step.
Features
Everything you need for a production-ready rich text input. See how we stack up against alternatives in the comparison table.
Examples
DX Helpers
Use usePromptAreaState() for zero-boilerplate state, mentionTrigger() / commandTrigger() / hashtagTrigger() for one-liner trigger setup, and getChipsByTrigger() to inspect segments.
Rotating Placeholders
Pass an array of strings to placeholder to cycle through them with a smooth animation. Great for hinting at what the input can do.
Async Search
Type @ to trigger an async search with 300ms debounce, AbortSignal cancellation, and an empty-state message. Results load after a simulated 500ms delay.
Markdown Formatting
Wrap text in **bold**, *italic*, or ***both*** to see inline styling. Use Cmd+B / Cmd+I shortcuts. Start a line with - or * for auto-formatted lists (Tab to indent).
Copy & Paste
Select content with chips in the source editor and Cmd+C to copy, then Cmd+V in the target to paste — chips are preserved. Pasting plain text like @Copywriter #campaign from outside auto-resolves matching triggers.
Image Attachments
Paste an image (screenshot or file) to attach it. Images show a loading spinner during upload simulation. Click × to remove. Use imagePosition to control placement.
File Attachments
Attach files with icon, name, and metadata. Cards show a file-type icon, truncated filename, and extension/size. With 4+ files, only the first 3 are shown with a “+N more” button to expand. Click × to remove.
Action Bar
A horizontal toolbar with left and right slots. Pairs with PromptArea for a complete chat input experience. Independently installable.
Full-Featured
Left slot with attach menu (+), @ mention, / command, and # tag buttons. Right slot with markdown toggle, microphone, and send button. The send button submits the message just like pressing Enter.
Status Bar
A horizontal bar with left and right slots for displaying contextual information. Sits above or below the PromptArea to show things like branch name, model selector, or project context. Independently installable.
Combined with Action Bar
Status bar on top with an action bar below the input for a full-featured layout.
Claude Code–Style
A complete composition combining PromptArea, ActionBar, and StatusBar to replicate a Claude Code–style chat input. Independently installable components composed together.
Demo
File chip above the input, a “Plan mode” toggle and model selector in the action bar, and project/branch context in the status bar.
Compact Prompt Area
A pill-shaped prompt input that expands downward on focus. Circular plus and submit buttons with a customizable slot for extras like a microphone. Independently installable.
Demo
Compact single-row input with circular plus and submit buttons. Expands downward on focus with a microphone slot before the submit button.
Chat Prompt Layout
A full-height chat layout with scrollable messages and a bottom-anchored prompt slot. Includes contextual scroll navigation buttons. Independently installable.
Chat Layout
Messages scroll independently while the prompt area stays anchored at the bottom. Scroll navigation buttons appear contextually.
Inspector
Inspect every event, segment, and API method in real time. Toggle disabled, markdown, and autoGrow. All 4 trigger types (/, @, #, !) and every callback log to the event panel. Imperative handle methods are wired to buttons below.
[
{
"type": "text",
"text": "Hello "
},
{
"type": "chip",
"trigger": "@",
"value": "strategist",
"displayText": "Strategist"
},
{
"type": "text",
"text": " — click a chip, paste text, or try every feature!"
}
]Dark Theme
Toggle between light, dark, and system themes using the switch in the sidebar. All components adapt automatically via CSS variables.
Comparison
Prompt Area combines mentions, slash commands, auto-resize, and rich text into a single component. Here's how it compares to popular alternatives that each cover only a subset of these features.
| Feature | Prompt Area | react-mentions Mention library | Tiptap ProseMirror framework | Lexical Meta editor framework | Plate.js Slate framework | BlockNote ProseMirror block editor | BlockSuite AFFiNE editor toolkit | react-textarea-autosize Auto-resize textarea |
|---|---|---|---|---|---|---|---|---|
| @Mentions / Tagging | ||||||||
| Slash Commands | ||||||||
| Auto-grow on Focus | ||||||||
| Inline Markdown | ||||||||
| Undo / Redo | ||||||||
| File & Image Attachments | ||||||||
| Dark Mode | ||||||||
| Accessibility (ARIA) | ||||||||
| IME Support (CJK) | ||||||||
| Copy/Paste Chip Preservation | ||||||||
| Action Bar / Toolbar | ||||||||
| Zero-config State Hook | ||||||||
| Bundle Approach | shadcn registry | npm package | npm package | npm package | npm package | npm package | npm package | npm package |
| Extra Dependencies | 0 | 0 | 3+ | 2+ | 5+ | 5+ | 5+ | 0 |
When to Use What
Use Prompt Area when you need a rich prompt input for AI or chat interfaces with mentions, commands, and tags in a single zero-dependency component.
Use Tiptap when you need a full document editor with collaborative editing, block-level formatting, and a ProseMirror plugin ecosystem.
Use Lexical when you need Meta's extensible editor framework with a plugin architecture for building custom editing experiences.
Use Plate.js when you need a full-featured Slate-based editor with a rich component library and advanced formatting.
Use react-mentions when you only need @mentions and nothing else — no commands, tags, or markdown.
Use react-textarea-autosize when you only need a plain textarea that auto-resizes, with no rich text features.
Head-to-Head Comparisons
Prompt Area vs Tiptap
Tiptap is a ProseMirror framework for building full rich-text editors with 3+ dependencies. Prompt Area is purpose-built for prompt and chat inputs with zero dependencies. Choose Tiptap if you need document editing with collaborative features and block-level formatting. Choose Prompt Area if you need a lightweight input with mentions, commands, tags, and file attachments without ProseMirror overhead.
Prompt Area vs Lexical
Lexical is Meta's extensible editor framework that requires assembling plugins for mentions and commands. Prompt Area provides these built-in with no plugin assembly required. Choose Lexical for extensible document editing with a plugin architecture. Choose Prompt Area for a ready-to-use chat input that works out of the box.
Prompt Area vs react-mentions
react-mentions handles @mentions only. Prompt Area adds /commands, #tags, inline markdown, file attachments, undo/redo, and four companion components (Action Bar, Status Bar, Compact Prompt Area, Chat Prompt Layout). Choose react-mentions if you only need basic mentions. Choose Prompt Area for a complete prompt input.
Prompt Area vs Plate.js
Plate.js is a Slate-based editor framework with 5+ dependencies. Prompt Area has zero dependencies and is focused on prompt inputs rather than document editing. Choose Plate.js for full-featured rich-text editors. Choose Prompt Area for AI chat and prompt UIs.
Prompt Area vs BlockNote
BlockNote is a ProseMirror-based block editor with 5+ dependencies, designed for Notion-style document editing. Prompt Area is a single-component textarea for chat inputs. Choose BlockNote for block-based document editing. Choose Prompt Area for prompt and chat interfaces.
Prompt Area vs react-textarea-autosize
react-textarea-autosize provides a plain textarea that auto-resizes. Prompt Area adds @mentions, /commands, #tags, inline markdown, file attachments, undo/redo, and structured data output. Choose react-textarea-autosize if you only need auto-resize with no rich features. Choose Prompt Area for a full-featured chat input.