npx shadcn@latest add https://sdk-components.thesqd.com/r/ai-fill.jsonimport { AiFill, AiFillCaption } from "@/components/ui/ai-fill";import * as React from "react";
import { AiFill } from "@/components/ui/ai-fill";
import { Input } from "@/components/ui/input";
export function Example() {
const [value, setValue] = React.useState("");
const [play, setPlay] = React.useState(0);
async function suggest() {
setValue(await suggestAudience()); // your model call
setPlay((n) => n + 1); // replays the fill, in place
}
return (
<AiFill play={play}>
<Input value={value} onChange={(e) => setValue(e.target.value)} />
</AiFill>
);
}AiFill (wraps any field; replays in place)
├── play={token} (change it to play again)
├── effect="both | sweep | ring" (default "both")
├── working (loop the sweep while the model answers)
└── children (the field: Input, Select, Textarea, a composer…)
AiFillCaption (the field's caption)
├── active (show the sparkle + label)
├── label="Suggested by AI"
└── children (the caption at rest)| Prop | Type | Default | Description |
|---|---|---|---|
play | unknown | — | Change it to play the fill again — a counter, the answer's id, the answer itself. `undefined`, `null`, `false` and `0` never play. Replays in place: the field is not remounted. |
effect | "both" | "sweep" | "ring" | "both" | The shimmer sweep and the brand ring, or one of them. |
working | boolean | false | Loops the sweep while a model is still answering. |
className | string | — | Give it the field's own radius if it is not `rounded-md`. |
| Prop | Type | Default | Description |
|---|---|---|---|
active | boolean | — | Swap to the sparkle and `label`. |
label | string | "Suggested by AI" | What the caption says while active. |
children | string | — | The caption at rest. |