AI product
Chat composer
the arrow sends · busy turns Send into Stop · onAttach turns on attachments (paperclip, chips)
function ComposerDemo() { const toast = useToast(); const [busy, setBusy] = React.useState(false); const [n, setN] = React.useState(0); return ( <View className="w-full gap-3"> <ChatComposer busy={busy} onStop={() => setBusy(false)} onSend={(text, files) => { toast.info(files.length ? `Sent with ${files.length} file${files.length > 1 ? 's' : ''}` : `Sent: ${text}`); setBusy(true); setTimeout(() => setBusy(false), 2000); }} onAttach={() => { const file = MOCK_FILES[n % MOCK_FILES.length]; setN((x) => x + 1); return [file]; }} /> <Text className="text-muted-foreground text-xs">The paperclip attaches a sample file; sending shows Stop for 2 seconds.</Text> </View> );}Usage
Pass onAttach only when the assistant can use files; it returns the files to attach (mock ones in a prototype). Files can be reviewed and removed before sending.
API
<ChatComposer onSend={(text, files) => …} busy? onStop? placeholder? onAttach? maxFiles? />Get it
Already in every copy of the native kit:
import { ChatComposer } from '@/components/kit/chat-composer';Details
- Exports
ChatComposer- Packages
- lucide-react-native@^1.21.0
- Installs with
- @halftone-native/attachment-chip, @halftone-native/icon, @halftone-native/lib-haptics, @halftone-native/lib-utils, @halftone-native/text
- Also searched as
- prompt, input, message box, attachments, upload, file
- Registry JSON
- /r/native/chat-composer.json
function ChatDemo() { const [turns, setTurns] = React.useState<{ text: string; files: File[] }[]>([]); return ( <div className="flex w-full max-w-xl flex-col gap-4"> {turns.map((t, i) => ( <ChatMessage key={i} role="user" initials="AM"> {t.files.length ? ( <span className="flex flex-wrap gap-2"> {t.files.map((f) => ( <AttachmentChip key={f.name} file={f} /> ))} </span> ) : null} {t.text ? <span>{t.text}</span> : null} </ChatMessage> ))} <ChatComposer onSend={(text, files) => setTurns((x) => [...x, { text, files }])} accept="" placeholder="Type, attach or drop a file" /> </div> );}Usage
Turn on accept only when the assistant can use files; say which kinds (“image/*,.pdf”). Files can be reviewed and removed before sending.
API
<ChatComposer onSend={(text, files) => …} busy? onStop? placeholder? accept? maxFiles? />Get it
Already in every copy of the web kit:
import { ChatComposer } from '@/components/kit/chat-composer';Details
- Exports
ChatComposer- Packages
- cn@^0.5.2, lucide-react@^1.52.0
- Installs with
- @halftone-web/attachment-chip, @halftone-web/button, @halftone-web/textarea
- Also searched as
- prompt, input, message box, attachments, upload, file
- Registry JSON
- /r/web/chat-composer.json
Agents: the whole registry is at /llms.txt.