Generate Button
The button that starts generation. A ring runs round it while the work goes, the label turns to Stop, and a check lands when it's done.
Needs: None.
Customize
size
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| onGenerate | (signal: AbortSignal) => Promise<unknown> | void | – | Starts the work. Return a promise and the button shows it running, then done; the signal aborts when Stop is pressed. |
| state | "idle" | "generating" | "done" | – | Controlled state. Leave out and the button runs itself from onGenerate's promise. Done settles back to idle on its own after a moment. |
| onStop | () => void | – | Called when Stop is pressed. |
| progress | number | – | 0 to 1 while generating. The ring fills to it; without it the ring sweeps. |
| label | string | "Generate" | The idle label. |
| stopLabel | string | "Stop" | The label while generating. |
| doneLabel | string | "Done" | The label beside the check. |
| accent | string | "" | Fill, glow and ring colour. Text on it is white, so pick a colour dark enough to carry it. |
| size | "sm" | "md" | "lg" | "md" | Height: 32, 40 or 48 px. |
| disabled | boolean | false | Disables the button. |
| className | string | – | Added to the root. |
| style | CSSProperties | – | Inline styles for the root. |