Prompt ComposerProv1.0.0
Where a person writes to a model: a box that grows with the text, Enter to send and Shift+Enter for a new line, Send that becomes Stop while a reply runs, and files by the clip button, drag and drop or paste into an attachments slot.
pnpm dlx shadcn@latest add @beautiful-ui-pro/lumen-prompt-composerNeeds your registry key. Your components.json style picks the Base UI or Radix build: radix-*, new-york and default get Radix, base-* gets Base UI.
Styles didn't apply?
The CLI adds the styles to the CSS file named in components.json (tailwind.css). Check that it points at your global stylesheet, that the project uses Tailwind CSS v4, and that the file is imported in your root layout. Installed by hand: paste styles.css into that file.
Usage
Import it and pass your content. The props that matter most are listed next.
"use client";
import * as React from "react";
import { PromptComposer } from "@/components/ui/lumen/controls/prompt-composer";
import { Attachment, AttachmentAction, AttachmentActions, AttachmentContent, AttachmentTitle } from "@/components/ui/lumen/attachment";
export function AskBox({ send, stop, running }: { send: (text: string, files: File[]) => void; stop: () => void; running: boolean }) {
const [files, setFiles] = React.useState<File[]>([]);
return (
<PromptComposer
running={running}
onStop={stop}
hint
onSubmit={({ text }) => {
send(text, files);
setFiles([]);
}}
onFiles={(added) => setFiles((all) => [...all, ...added])}
accept="image/*,.pdf,.csv"
attachments={
files.length > 0 &&
files.map((f) => (
<Attachment key={f.name} size="sm">
<AttachmentContent>
<AttachmentTitle>{f.name}</AttachmentTitle>
</AttachmentContent>
<AttachmentActions>
<AttachmentAction icon="close" aria-label={`Remove ${f.name}`} onClick={() => setFiles((all) => all.filter((x) => x !== f))} />
</AttachmentActions>
</Attachment>
))
}
/>
);
}Props
value / defaultValue / onValueChange–stringControlled or not. Uncontrolled text clears after sending.
onSubmit–({ text }) => void | booleanSend. Return false to keep the text (a validation failed).
running / onStop–boolean / () => voidA reply is running: Send becomes Stop with a thin arc around it, Escape stops, Enter no longer sends.
onFiles / accept / multiple— / — / true(files: File[]) => void / string / booleanShows the clip button; files also arrive by drop and paste. Show them in attachments.
attachments–ReactNodeAbove the text: the files waiting to go (Lumen Attachment fits).
tools–ReactNodeYour controls in the footer (a model picker, a mode toggle).
Show all 12 propsShow fewer
submitOn"enter""enter" | "mod-enter"mod-enter: Cmd/Ctrl+Enter sends and Enter is a new line (long-form prompts).
hintfalsebooleanShow the keyboard hint in the footer (hidden on narrow screens).
canSubmitEmptyfalsebooleanAllow sending with no text (attachments alone).
maxRows8numberRows the box grows to before it scrolls.
labels–Partial<PromptComposerLabels>input (the accessible name), send, stop, attach, drop, hint(mode, mac).
textareaRef–Ref<HTMLTextAreaElement>The textarea, to focus it from elsewhere.
Source
components/ui/lumen/controls/prompt-composer.tsx
This component is included with Pro.
Try the live preview above. Get Pro to install the source.