PromptInput

A multi-line textarea with a submit button designed for AI chat interfaces, supporting loading states and attachment slots.

import { PromptInput } from "@aetherstack/ui"

Installation

terminal
npx aether-ui add prompt-input

Import

import.tsx
import { PromptInput } from "@aetherstack/ui"

Usage

promptinput.tsx
const [value, setValue] = React.useState("")

<PromptInput
  value={value}
  onValueChange={setValue}
  onSubmit={(v) => console.log("submit:", v)}
  placeholder="Ask anything…"
  isLoading={false}
  maxLength={4000}
/>

Props

PropTypeDefaultDescription
valuestring""Controlled textarea value.
onValueChange(v: string) => voidCallback on value change.
onSubmit(value: string) => voidCalled when user submits via Enter key or the submit button.
placeholderstring"Ask anything…"Textarea placeholder text.
disabledbooleanfalseDisables the input and submit button.
isLoadingbooleanfalseShows a spinner on the submit button while a response is in flight.
maxLengthnumberCharacter limit; a counter is shown near the submit button when set.
attachSlotReact.ReactNodeSlot rendered above the textarea — typically AttachmentChip components.
classNamestringAdditional CSS classes.

* Required

Accessibility

  • Submit button label changes to 'Stop' during loading so screen readers reflect the current action.
  • Keyboard shortcut: Enter submits, Shift+Enter inserts a newline.
  • Character counter is announced via aria-live when approaching the limit.