Skip to content

ChatInput

Composite input component with auto-resizing textarea and send action bar, designed for chat scenarios.

Basic Usage

vue
<script setup>
import { ref } from 'vue'
const message = ref('')
</script>

<AChatInput
  v-model="message"
  placeholder="Type a message..."
  send-label="Send"
  @send="handleSend"
/>

Action Bar

Use the actions-left slot to insert attachment, voice, and other action buttons.

vue
<AChatInput v-model="text" placeholder="Reply...">
  <template #actions-left>
    <button class="chat-input-btn" title="Attachment">
      <!-- Attachment icon -->
    </button>
    <button class="chat-input-btn" title="Voice">
      <!-- Voice icon -->
    </button>
  </template>
</AChatInput>

Deep Thinking

Enable the deep thinking toggle with show-thinking.

Thinking mode: Off

vue
<script setup>
import { ref } from 'vue'
const message = ref('')
const thinking = ref(false)
</script>

<AChatInput
  v-model="message"
  :show-thinking="true"
  v-model:thinking="thinking"
  thinking-label="Deep thinking"
/>

Model Select

Enable model selection with show-model-select.

Current model: claude3

vue
<script setup>
import { ref } from 'vue'
const message = ref('')
const model = ref('claude3')
const models = [
  { label: 'GPT-4o', value: 'gpt4o' },
  { label: 'Claude 3.5 Sonnet', value: 'claude3' }
]
</script>

<AChatInput
  v-model="message"
  :show-model-select="true"
  v-model:model="model"
  :models="models"
/>

Combined

Deep thinking and model select can be enabled together.

vue
<AChatInput
  v-model="message"
  :show-thinking="true"
  v-model:thinking="thinking"
  :show-model-select="true"
  v-model:model="model"
  :models="models"
/>

Interaction

  • Enter to send — Press Enter to send and clear the input
  • Shift+Enter for newline — Use the shortcut for line breaks
  • Auto-resize — Textarea grows with content, max 6 rows
  • Send button state — Disabled when content is empty
  • Deep thinking — Toggle panel, supports two-way binding
  • Model select — Model list popup, supports two-way binding

API

Props

NameTypeDefaultDescription
modelValuestring''Bound value
placeholderstring'Type a message...'Input placeholder
disabledbooleanfalseDisabled
maxRowsnumber6Auto-resize max rows
sendLabelstring'Send'Send button text
showThinkingbooleanfalseShow deep thinking icon
thinkingbooleanfalseDeep thinking state
thinkingLabelstring'Deep thinking'Deep thinking label text
showModelSelectbooleanfalseShow model select icon
modelstring''Currently selected model
modelsModelOption[][]Model options list
modelPlaceholderstring'Select model'Model select placeholder

ModelOption

NameTypeDefaultDescription
labelstringDisplay text
valuestringOption value

Emits

NameParametersDescription
update:modelValuevalue: stringInput value changed
sendvalue: stringUser sent message
focusevent: FocusEventInput focused
blurevent: FocusEventInput blurred
update:thinkingvalue: booleanThinking state changed
update:modelvalue: stringSelected model changed

Slots

NameDescription
actions-leftLeft side of action bar (after built-in icons)
actions-rightRight side of action bar (before send button)

MIT License