N/A

ChatPrompt

Build chat input flows with an auto-resizing prompt, keyboard shortcuts, and flexible slot composition.

Installation

pnpm dlx shadcn-vue@latest add "https://ui.stackhacker.io/r/chat-prompt.json"

Usage

<script setup lang="ts">
import { ChatPrompt } from '@/components/ui/chat-prompt'

const input = ref('')
</script>

<template>
  <ChatPrompt v-model="input" @submit="handleSubmit" />
</template>

Examples

Default

API Reference

Props

PropTypeDefaultDescription
modelValuestring''Current input value (v-model).
placeholderstring'Type your message here...'Textarea placeholder text.
disabledbooleanfalseDisable the prompt.
autofocusbooleanfalseAuto-focus the textarea on mount.
errorError | nullError state.
classstringAdditional CSS classes.

Emits

EventPayloadDescription
update:modelValuestringEmitted when the input value changes.
submitEventEmitted when Enter is pressed (without Shift) or the form is submitted.

Slots

SlotDescription
headerContent rendered above the textarea.
footerContent rendered below the textarea, typically for action buttons.

Expose

NameTypeDescription
textareaRefRef<HTMLTextAreaElement>Reference to the underlying textarea element.