Prompt input

Free

The locked composer's box alone: it grows with the words to six lines, sends on Enter, and send becomes Stop while the model answers. Files, a quote and notices still fit in it.

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

Preview

Grows with the text, sends on Enter, and Send turns into Stop while the model answers.
Status

When to use

Use it when

  • A chat that only sends and stops: a support widget, an inline ask box.

Use something else when

  • Models, tools, a folder or permissions to choose, or a queue while the agent works: use the composer field.

Installation

Terminal
npx shadcn@latest add https://pixilui.com/r/prompt-input.json

Adds prompt-input.tsx with button.tsx, chip.tsx, dropdown-menu.tsx, text-shimmer.tsx, kbd.tsx, tooltip.tsx, meter.tsx, usage-meter.tsx and composer-field.tsx, and installs clsx and tailwind-merge. The URL works in any app with a components.json, with no registry to add first.

Usage

example.tsx
import { PromptInput } from "@/components/pixilui/prompt-input";

<PromptInput
  icons={icons}
  onChange={onChange}
  onSubmit={onSubmit}
/>

Fills its container.

API reference

PropTypeDefault
iconsRequiredComposerIcons–The icons it draws (composerIcons in composer-field's examples).
statusComposerStatus–The chat's status: submitted or streaming shows Stop.
defaultValuestring–Words in the box at first.
onChange(text: string) => void–Runs as the words change.
onSubmit(draft: ComposerMessageDraft) => void | boolean | Promise<void>–Runs on Enter or Send with what to send; the box then clears. Return false to keep the words.
onStop() => void–Runs on Stop (or Escape) while the model answers.
placeholderstring–The placeholder ("Ask anything").

Also takes every native <div> attribute except onSubmit, onChange, defaultValue, and a ref.

Keyboard

EnterSends, never while event.nativeEvent.isComposing (Japanese and Chinese input).
⇧ EnterAdds a line.
EscStops the answer.

Accessibility

  • The field is a textbox (aria-multiline); send stays focusable when it can't send, its reason as the tooltip.

Motion

  • The field grows and glides with the words; the send sweep as a message leaves; the arrow turns into the stop square while the model answers. Reduced motion: at once.
Composer fieldKeep typing while the agent works: messages wait in order, and Stop puts them back.
TextareaGrows as you write, with a counter that warns near the limit.
Agent avatarThe agent's face acts out its work, blinking on every change and hopping when done.

PixilUI Pro opens soon. The first 20 licenses are $99.