Message Input

<mcp-message-input>

Message input with auto-resizing textarea, send button, and keyboard shortcuts.

AIWeb Component

Overview

Message input with auto-resizing textarea, send button, and keyboard shortcuts.

Preview

Preview
Loading components...

Import

javascript
// Import all components (recommended)
import '@mcpsystem/ui';

// Or import the class for TypeScript
import { McpMessageInput } from '@mcpsystem/ui';

Basic Usage

html
<mcp-message-input placeholder="Ask Claude anything..."></mcp-message-input>

API Reference

Properties(6)

PropertyAttributeType
placeholderplaceholderstring
disableddisabledboolean
maxLengthmax-lengthnumber
maxRowsmax-rowsnumber
valuevaluestring
showCountshow-countboolean

Slots(3)

SlotDescription
prefixContent before the textarea (e.g., attachment button)
suffixContent after the textarea (e.g., voice input button)
send-iconCustom icon for send button

Events(4)

EventDetail
mcp-submit{ value: string }
mcp-input{ value: string }
mcp-focus-
mcp-blur-

CSS Parts(4)

Style internal elements using ::part() selector.

PartDescription
::part(container)The outer container
::part(textarea)The textarea element
::part(send-button)The send button
::part(character-count)The character count display

CSS Custom Properties(5)

Customize appearance by setting these CSS variables.

PropertyDescription
--mcp-input-bgInput background color
--mcp-input-borderInput border color
--mcp-input-radiusInput border radius
--mcp-input-min-heightMinimum input height
--mcp-input-max-heightMaximum input height before scroll

Examples

Basic Usage

Preview
Loading components...
html
<mcp-message-input placeholder="Ask Claude anything..."></mcp-message-input>

With Character Limit

Preview
Loading components...
html
<mcp-message-input max-length="500" show-count></mcp-message-input>

Handle Submit

Preview
Loading components...
html
<mcp-message-input id="input"></mcp-message-input>
<script>
  document.getElementById('input').addEventListener('mcp-submit', (e) => {
    console.log('Submitted:', e.detail.value);
  });
</script>

More Components