Prompt Input
Composer with attachments, tools, speech, and submit/stop.
Import
import { PromptInput } from "@cronus-ui/ui";
npx cronus-ui add prompt-input
Examples
.cronus
The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.
default.cronus
app "audit-fixtures" {
port 5176
}
style {
preset aurora
theme dark
}
component PromptInputDefault layout:inline style:prompt-input {
action:"/chat"
method:"post"
label "What would you like to know?"
text "What would you like to know?"
}
page "/audit/prompt-input/default" type:custom {
use PromptInputDefault
}
API Reference
Generated from the component's exported types.
PromptInputLabels
| Prop | Type | Default | Description |
|---|---|---|---|
upload | string | — | — |
removeAttachment | string | — | — |
unknownFile | string | — | — |
addAttachments | string | — | — |
submit | string | — | — |
stop | string | — | — |
placeholder | string | — | Placeholder shown when the value is empty. |
speech | string | — | — |
speechStop | string | — | — |
errorAccept | string | — | — |
errorMaxFileSize | string | — | — |
errorMaxFiles | string | — | — |
PromptInputControllerProps
| Prop | Type | Default | Description |
|---|---|---|---|
textInput* | TextInputContext | — | — |
attachments* | AttachmentsContext | — | — |
__registerFileInput* | (ref: RefObject<HTMLInputElement | null>, open: () => void) => void | — | INTERNAL: Allows PromptInput to register its file input + "open" callback |
PromptInputProviderProps
Extends PropsWithChildren<{ initialInput?: string; }>
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Contents of the component. |
initialInput | string | — | Seed value for the prompt field. |
PromptInputAttachmentProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
data* | FileUIPart & { id: string } | — | — |
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |
PromptInputAttachmentsProps
Extends Omit<HTMLAttributes<HTMLDivElement>, "children">
| Prop | Type | Default | Description |
|---|---|---|---|
children* | (attachment: FileUIPart & { id: string }) => ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
id | string | — | DOM id of the root element. |
PromptInputActionAddAttachmentsProps
Extends ComponentProps<typeof DropdownMenuItem>
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | — |
disabled | boolean | — | Disables pointer and keyboard interaction. |
onSelect | (event: Event) => void | — | Called when the item is chosen. |
textValue | string | — | Text used for typeahead. Defaults to the item's text. |
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputProps
Extends Omit<HTMLAttributes<HTMLFormElement>, "onSubmit" | "onError">
| Prop | Type | Default | Description |
|---|---|---|---|
ref | Ref<HTMLFormElement> | — | Ref forwarded to the underlying DOM node. |
accept | string | — | — |
multiple | boolean | — | — |
globalDrop | boolean | — | — |
syncHiddenInput | boolean | — | — |
maxFiles | number | — | — |
maxFileSize | number | — | — |
onError | (err: { code: "max_files" | "max_file_size" | "accept"; message: string }) => void | — | — |
onSubmit* | ( message: PromptInputMessage, event: FormEvent<HTMLFormElement>, ) => void | Promise<void> | — | — |
labels | PromptInputLabels | — | Override default English strings. |
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |
PromptInputBodyProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |
PromptInputTextareaProps
Extends ComponentProps<typeof Textarea>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputHeaderProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |
PromptInputFooterProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |
PromptInputToolsProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |
PromptInputButtonProps
Extends ComponentProps<typeof Button>
| Prop | Type | Default | Description |
|---|---|---|---|
variant | string | — | Visual variant. |
size | string | — | Control size. |
asChild | boolean | — | Render as the child element via Slot. |
disabled | boolean | — | Disables pointer and keyboard interaction. |
type | string | — | Native type of the underlying element. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputActionMenuProps
Extends ComponentProps<typeof DropdownMenu>
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | — | Controlled open state. |
defaultOpen | boolean | — | Uncontrolled initial open state. |
onOpenChange | (open: boolean) => void | — | Called when the open state changes. |
children | ReactNode | — | Contents of the component. |
modal | boolean | — | When true, interaction outside the surface is blocked. |
PromptInputActionMenuTriggerProps
Extends ComponentProps<typeof Button>
| Prop | Type | Default | Description |
|---|---|---|---|
variant | string | — | Visual variant. |
size | string | — | Control size. |
asChild | boolean | — | Render as the child element via Slot. |
disabled | boolean | — | Disables pointer and keyboard interaction. |
type | string | — | Native type of the underlying element. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputActionMenuContentProps
Extends ComponentProps<typeof DropdownMenuContent>
| Prop | Type | Default | Description |
|---|---|---|---|
side | "top" | "right" | "bottom" | "left" | — | Preferred side of the trigger. |
align | "start" | "center" | "end" | — | Alignment along the chosen side. |
sideOffset | number | — | Distance in pixels from the trigger. |
alignOffset | number | — | Offset along the alignment axis. |
forceMount | boolean | — | Keep the node mounted when closed, for exit animation. |
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputActionMenuItemProps
Extends ComponentProps<typeof DropdownMenuItem>
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | — | Disables pointer and keyboard interaction. |
onSelect | (event: Event) => void | — | Called when the item is chosen. |
textValue | string | — | Text used for typeahead. Defaults to the item's text. |
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputSubmitProps
Extends ComponentProps<typeof Button>
| Prop | Type | Default | Description |
|---|---|---|---|
status | ChatStatus | — | — |
variant | string | — | Visual variant. |
size | string | — | Control size. |
asChild | boolean | — | Render as the child element via Slot. |
disabled | boolean | — | Disables pointer and keyboard interaction. |
type | string | — | Native type of the underlying element. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputSpeechButtonProps
Extends ComponentProps<typeof PromptInputButton>
| Prop | Type | Default | Description |
|---|---|---|---|
textareaRef | RefObject<HTMLTextAreaElement | null> | — | — |
onTranscriptionChange | (text: string) => void | — | — |
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputModelSelectProps
Extends ComponentProps<typeof Select>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputModelSelectTriggerProps
Extends ComponentProps<typeof SelectTrigger>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputModelSelectValueProps
Extends ComponentProps<typeof SelectValue>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputModelSelectContentProps
Extends ComponentProps<typeof SelectContent>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputModelSelectItemProps
Extends ComponentProps<typeof SelectItem>
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Controlled value. |
disabled | boolean | — | Disables pointer and keyboard interaction. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputHoverCardProps
Extends ComponentProps<typeof HoverCard>
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | — | Controlled open state. |
defaultOpen | boolean | — | Uncontrolled initial open state. |
onOpenChange | (open: boolean) => void | — | Called when the open state changes. |
children | ReactNode | — | Contents of the component. |
PromptInputHoverCardTriggerProps
Extends ComponentProps<typeof HoverCardTrigger>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputHoverCardContentProps
Extends ComponentProps<typeof HoverCardContent>
| Prop | Type | Default | Description |
|---|---|---|---|
side | "top" | "right" | "bottom" | "left" | — | Preferred side of the trigger. |
align | "start" | "center" | "end" | — | Alignment along the chosen side. |
sideOffset | number | — | Distance in pixels from the trigger. |
alignOffset | number | — | Offset along the alignment axis. |
forceMount | boolean | — | Keep the node mounted when closed, for exit animation. |
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputTabsListProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |
PromptInputTabProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |
PromptInputTabLabelProps
Extends HTMLAttributes<HTMLHeadingElement>
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |
PromptInputTabBodyProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |
PromptInputTabItemProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |
PromptInputCommandProps
Extends ComponentProps<typeof Command>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputCommandInputProps
Extends ComponentProps<typeof CommandInput>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputCommandListProps
Extends ComponentProps<typeof CommandList>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputCommandEmptyProps
Extends ComponentProps<typeof CommandEmpty>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputCommandGroupProps
Extends ComponentProps<typeof CommandGroup>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputCommandItemProps
Extends ComponentProps<typeof CommandItem>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
PromptInputCommandSeparatorProps
Extends ComponentProps<typeof CommandSeparator>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |