chat-input-demo-simple
simple-ai/chat-input-demo-simpleFreeExample
simple-ai publishes no description for this item.
Install it
npx shadcn@latest add https://simple-ai.dev/r/chat-input-demo-simple.jsonSource
1"use client";23import { useState } from "react";4import { toast } from "sonner";5import {6 ChatInput,7 ChatInputEditor,8 ChatInputGroupAddon,9 ChatInputSubmitButton,10 useChatInput,11} from "@/registry/ui/chat-input";1213export default function ChatInputDemo() {14 const [isLoading, setIsLoading] = useState(false);1516 const { value, onChange, handleSubmit } = useChatInput({17 onSubmit: (parsed) => {18 setIsLoading(true);19 toast(parsed.content);20 setTimeout(() => setIsLoading(false), 1000);21 },22 });2324 return (25 <div className="w-full h-full flex justify-center items-center">26 <div className="w-full max-w-md">27 <ChatInput28 onSubmit={handleSubmit}29 value={value}30 onChange={onChange}31 isStreaming={isLoading}32 onStop={() => setIsLoading(false)}33 >34 <ChatInputEditor placeholder="Type a message..." />35 <ChatInputGroupAddon align="block-end">36 <ChatInputSubmitButton className="ml-auto" />37 </ChatInputGroupAddon>38 </ChatInput>39 </div>40 </div>41 );42}
Files it writes
More from simple-ai
All 77 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| chat-input-demo-mentionschat-input-demo-mentions | simple-ai | Examples | Free | no deps | |
| chat-input-with-addonschat-input-with-addons | simple-ai | Examples | Free | no deps | |
| chat-message-area-demochat-message-area-demo | simple-ai | Examples | Free | no deps | |
| chat-message-area-demo-alignmentchat-message-area-demo-alignment | simple-ai | Examples | Free | no deps | |
| chat-message-area-demo-streamingchat-message-area-demo-streaming | simple-ai | Examples | Free | no deps | |
| chat-message-demochat-message-demo | simple-ai | Examples | Free | no deps | |
| chat-message-demo-avatar-imagechat-message-demo-avatar-image | simple-ai | Examples | Free | no deps | |
| chat-message-demo-simplechat-message-demo-simple | simple-ai | Examples | Free | no deps |
