Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Conversation

  • Conversation
  • ChatMessage
  • PromptInput
  • TypingDots

Reasoning and Tools

  • ThinkingBlock
  • ToolCall
  • AgentPlan
  • Dossier
  • Artifact
  • ConfirmCard
  • ThreadList
  • TaskRunner

Assistance

  • StreamingText
  • PromptSuggestions
  • MessageActions
  • Citation

PromptInput

prompt-input

Composes auto-growing prompts with submit, stop, keyboard, IME, and custom action controls.

Usage

Basic usage

Enter Submit / Shift+Enter Line break / IME No accidental touch during synthesis; onSubmit The text after receiving trim will be automatically cleared internally when it is not controlled.

tsx
<PromptInput onSubmit={(v) => send(v)} />

Generating (stop key)

When loading is entered, the send key changes to the stop key and submission is blocked. Click to trigger onStop.

tsx
<PromptInput loading onStop={() => stop()} defaultValue="Generating answer..." />

Disabled

disabled overall weakens and blocks input and submission.

tsx
<PromptInput disabled placeholder="Log in to send..." />

Custom placeholder

placeholder overrides the default prompt text.

tsx
<PromptInput placeholder="Ask me any questions about Hulian..." />

When to Use

Use it as the composer at the bottom of a chat interface. It grows with its content, submits on Enter, and shows a stop button while generating. Render the message stream with Conversation and ChatMessage; PromptInput handles composition and submission only.

Import

ts
import { PromptInput } from "@hulianui/ui"

Props

NameTypeDefaultDescription
valuestring-Controlled value (with onValueChange)
defaultValuestring""Uncontrolled initial value
placeholderstring"\u53d1\u6d88\u606f\u2026" ("Send a message...")Placeholder prompt
loadingbooleanfalseGenerating: Send key becomes stop key, block submission
disabledbooleanfalseDisabled
maxRowsnumber8Maximum rows before the textarea scrolls internally
classNamestring-Container class name

Events

EventTypeDescription
onValueChange(value: string) => voidValue change callback
onSubmit(value: string) => voidSubmit (Enter or click Send); receive the current text after trim. Automatically clear internally when not under control
onStop() => voidClick to stop callback (stop button is displayed during loading)

Slots

SlotTypeDescription
actionsReactNodeOperation slot on the left side of the bottom toolbar (switch chip for deep thinking/intelligent search, etc.)
trailingReactNodeTrailing slot on the right side of the bottom toolbar, before the send key (attachment/voice, etc. icon buttons)

Usage Guidelines

  • Choose one of controlled/uncontrolled: value must be configured with onValueChange to manage the status by itself; when it is not controlled (only defaultValue), it will be automatically cleared internally after submission, do not clear it externally.
  • While loading is true, submission is blocked and the send button becomes a stop button. Pass onStop; otherwise the stop button has no action.
  • Enter to submit, Shift+Enter to change line, and IME synthesis protection has been implemented internally (Chinese input and enter word selection will not be submitted by mistake).
  • Built-in Chinese UI strings are \u53d1\u6d88\u606f\u2026 ("Send a message..."), \u505c\u6b62\u751f\u6210 ("Stop generating"), and \u53d1\u9001 ("Send").

Related

Conversation · ChatMessage · TypingDots · ThinkingBlock · ToolCall · AgentPlan

Playground

<PromptInput onSubmit={(v) => send(v)} />
PreviousChatMessageAI AgentsNextTypingDots

On this page

  • Usage
  • Documentation
    • When to Use
    • Import
    • Props
    • Events
    • Slots
    • Usage Guidelines
    • Related
  • Playground