Skip to content

Commit 433e919

Browse files
authored
feat: add an auto-expanding textarea (#35)
1 parent 35dcff0 commit 433e919

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

chat/bun.lock

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chat/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"next-themes": "^0.4.6",
2525
"react": "^19.0.0",
2626
"react-dom": "^19.0.0",
27+
"react-textarea-autosize": "^8.5.9",
2728
"sonner": "^2.0.3",
2829
"tailwind-merge": "^3.3.0"
2930
},

chat/src/components/message-input.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
} from "lucide-react";
1515
import { Tabs, TabsList, TabsTrigger } from "./ui/tabs";
1616
import type { ServerStatus } from "./chat-provider";
17+
import TextareaAutosize from "react-textarea-autosize";
1718

1819
interface MessageInputProps {
1920
onSendMessage: (message: string, type: "user" | "raw") => void;
@@ -167,7 +168,7 @@ export default function MessageInput({
167168
: "Click or focus this area to send keystrokes to terminal"}
168169
</div>
169170
) : (
170-
<textarea
171+
<TextareaAutosize
171172
autoFocus
172173
ref={textareaRef}
173174
value={message}
@@ -178,7 +179,7 @@ export default function MessageInput({
178179
? "Running..."
179180
: "Type a message..."
180181
}
181-
className="resize-none w-full text-sm outline-none p-4 h-20"
182+
className="resize-none w-full text-sm outline-none p-4 h-20 max-h-[400px]"
182183
disabled={serverStatus !== "stable"}
183184
/>
184185
)}

0 commit comments

Comments
 (0)