PromptInput
Auto-growing composer: Enter sends, Shift+Enter new line, attach, tools, model slot, send/stop.
Code
import * as React from 'react';
import { AttachmentChip, Badge, Chip, PromptInput } from '@fruit-labs/design';
export default function Demo() {
return (
<div
style={{
maxWidth: 640,
}}
>
<PromptInput
{...{
onAttach() {},
}}
attachments={
<AttachmentChip
name="brief.pdf"
{...{
onRemove() {},
}}
/>
}
tools={
<Chip icon="search" selected={false}>
Web search
</Chip>
}
model={<Badge>Fast</Badge>}
/>
</div>
);
}Install
From npm:
npm install @fruit-labs/design
import { PromptInput } from '@fruit-labs/design';Or copy the TypeScript source into your project:
npx shadcn@latest add https://design.fruitlabs.online/r/prompt-input.jsonGuidelines
- While the agent runs set
busy(send becomes Stop). - Put AttachmentChips in
attachments, a ModelPicker inmodel, tool toggles intools.
Props
| Prop | Type | Required |
|---|---|---|
value | string | No |
defaultValue | string | No |
onChange | (value: string) => void | No |
onSubmit | (value: string) => void | No |
onStop | () => void | No |
onAttach | () => void | No |
busy | boolean | No |
placeholder | string | No |
attachments | React.ReactNode | No |
tools | React.ReactNode | No |
model | React.ReactNode | No |
maxHeight | number | No |
label | string | No |
className | string | No |