Prompt Area

A contentEditable rich text input with trigger-based chips, inline markdown, undo/redo, and list auto-formatting. Built as a shadcn registry component.

npx shadcn@latest add https://prompt-area.com/r/prompt-area.json

Try It

All capabilities in one editor. / commands (start of line, inline style), @ mentions (pill style), # tags (auto-resolve on space), ! callback mode. Cmd+B bold, Cmd+I italic, Ctrl+Z/Ctrl+Shift+Z undo/redo. Type - for lists, paste a URL for auto-linking, or use the buttons below to call the imperative API. Enter to submit, Escape to dismiss.

Segments (0)
[]
Event Log
No events yet — try interacting above

All Options

Every prop and option in a single example. Toggles for disabled, markdown, and autoGrow. All 4 trigger types (/ start-of-line dropdown, @ pill dropdown, # auto-resolve on space, ! callback mode). Every callback (onSubmit, onEscape, onChipClick, onChipAdd, onChipDelete, onLinkClick, onPaste, onUndo, onRedo) logs to the event panel. Imperative handle methods (focus, blur, insertChip, getPlainText, clear) are wired to buttons. Also sets minHeight, maxHeight, className, aria-label, and data-test-id.

Segments (3)
[
  {
    "type": "text",
    "text": "Hello "
  },
  {
    "type": "chip",
    "trigger": "@",
    "value": "alice",
    "displayText": "Alice"
  },
  {
    "type": "text",
    "text": " — click a chip, paste text, or try every feature!"
  }
]
Event Log
Interact to see events…

Examples

Basic (no triggers)

Simple text input with Enter to submit.

@Mentions

Type @ followed by a name to search users.

/Commands (start of line)

Type / at the beginning of a line for commands.

#Tags (auto-resolve on space)

Type #tag and press space to auto-create a chip. Backspace reverts it.

Callback mode (!)

Type ! to fire a callback that programmatically inserts a chip.

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 @alice #bug from outside auto-resolves matching triggers.

Source (select & copy)
Target (paste here)

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.

Images Above (default)
Landscape
Chart
Images Below

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.

Normal (1–3 files)
quarterly-report.pdf
PDF · 2.3 MB
user-data-export-2024-final-version.csv
CSV · 827.3 KB
config.json
JSON · 1.2 KB
Many files (4+ files, collapsible with expand)
presentation.pdf
budget-2024.csv
notes.txt

Action Bar

A horizontal toolbar with left and right slots. Pairs with PromptArea for a complete chat input experience. Independently installable.

npx shadcn@latest add https://prompt-area.com/r/action-bar.json

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.

Minimal

Just a send button on the right. The simplest composition.

Disabled

Both PromptArea and ActionBar in disabled state.

Dark Theme

Toggle between light, dark, and system themes using the switch in the sidebar. All components adapt automatically via CSS variables.

Preview

A side-by-side comparison of the prompt area in light and dark themes.

Light

Dark