shadcn.io is not affiliated with official shadcn/ui
Input Group examples · AI
Simple AI Prompt Input Group for React
An AI prompt box with an enhance button, a character limit and a send button under the textarea.
The smallest useful AI composer: a textarea, then a row with a sparkles button to improve the prompt, a 0/4000 character limit, a short divider and a round send button. Start here and add menus only when the product needs them.
Preview
Installation
FAQ
What sits under the prompt?
An InputGroupAddon with align="block-end", written after InputGroupTextarea, holding the sparkles button, an InputGroupText with 0/4000, a vertical Separator and the send button.
What does the sparkles button do?
It's a ghost, icon-only InputGroupButton named Enhance prompt, with no action in the demo. Use it to rewrite or expand the prompt before sending.
Does 0/4000 track the prompt?
No, it's fixed text. Keep the textarea's value in state, render its length there, and set maxLength on InputGroupTextarea to enforce the limit.
What is the short line before send?
A Separator with orientation="vertical" and h-4!, between the count and the send button.
Related
- AI Prompt Input Input GroupAn AI prompt box with a mode menu, a
- AI with Attachments Input GroupAn AI prompt box with an attachment menu
- AI with Voice Input GroupAn AI prompt box with attach and voice
- Code Editor Input GroupA code box with a file name and refresh
- Search with Icon Input GroupA search input with a magnifying glass at
- Copy Button Input GroupA read-only link with a copy button that