Browse components
Ask Box
AI prompt input that grows with your text, holds springy attachment chips, and morphs its send arrow into a stop button ringed by a spinner while generating.
Installation
npx shadcn@latest add @glint-ui/ask-boxFirst time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/ask-box.json
Usage
import { AskBox } from "@/components/ui/ask-box";
<AskBox
onSubmit={(text, files) => streamAnswer(text, files)}
onStop={() => controller.abort()}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| placeholder | string | "Ask anything…" | Placeholder text. |
| maxRows | number | 6 | Lines the field grows to before it scrolls. |
| generating | boolean | false | Force the generating state. |
| onSubmit | ReactNode | — | (text, files) => void | Promise. A returned promise shows the generating state until it settles. |
| onStop | ReactNode | — | Called when stop is pressed while generating. |
| defaultFiles | ReactNode | — | Files attached on mount. |
| className | string | — | Extra classes for the root element. |