Prompt

Multi-line input with toolbar for AI/chat interfaces

Setup

import { Prompt } from '@fragments-sdk/ui';

Examples

Basic

Simple prompt with submit button

Loading preview...

With Actions

Prompt with attachment and mode buttons

Loading preview...

With Usage

Shows token usage indicator

Loading preview...

Loading State

During API submission

Loading preview...

Disabled

Non-interactive prompt

Loading preview...

Props

PropTypeDefaultDescription
childrenRequirednodeNot setPrompt composition using Prompt sub-components
valuestringNot setControlled input value
defaultValuestringUncontrolled default value
onChangefunctionNot setCalled when value changes
onSubmitfunctionNot setCalled on form submission
placeholderstringAsk, Search or Chat...Placeholder text for the textarea
disabledbooleanfalseDisable the entire prompt
loadingbooleanfalseShow loading state
minRowsnumber1Minimum number of visible rows
maxRowsnumber8Maximum number of visible rows
autoResizebooleantrueEnable auto-resize based on content
submitOnEnterbooleantrueSubmit on Enter (Shift+Enter for newline)
variantenumdefaultfixedstickydefaultVisual/positioning variant

Usage Guidelines

When to use

  • Building chat or AI assistant interfaces
  • Need multi-line input with submit action
  • Require toolbar with actions like attachments or model selection

When not to use

  • Simple single-line text input (use Input)
  • Basic multi-line without toolbar (use Textarea)
  • Search-only interface (use Input with search variant)

Best practices

  • Always provide an onSubmit handler
  • Use loading state during API calls
  • Prompt.Textarea forwards native textarea props (autoComplete, inputMode, aria-*, data-*, handlers)
  • Prompt.Textarea composes your onChange/onKeyDown handlers with built-in submit and auto-resize behavior
  • Consider showing usage/token limits for AI contexts
Accessibility
  • Enter submits, Shift+Enter for newline
  • Submit button is keyboard accessible
  • Loading state prevents duplicate submissions