Generate Button
AI style call to action with idle, generating and loading states.
pnpm dlx @glinui/cli@latest add generate-buttonInstallation
pnpm dlx @glinui/cli@latest add generate-buttonCredits. Adapted from Vengeance UI (MIT, (c) 2025-2026 Ashutoshx7). Scoped Tailwind instead of an injected style tag, token colors, explicit generating and loading states, live status text, glass and sizes. Attribution details.
Prefer the package?
Usage
Improvements: no injected style tag or font stack, scoped utilities on tokens, explicit generating and loading props instead of focus-driven state, aria-busy with a polite announcement, real disabled state, variant vocabulary (glinr default, glass opt-in), sizes and asChild.
Variants
The shining label follows the surface text colour on every variant.
<div className="flex flex-wrap items-center gap-3"><GenerateButton variant="glinr" label="glinr" /><GenerateButton variant="solid" label="solid" /><GenerateButton variant="plain" label="plain" /><GenerateButton variant="soft" label="soft" /><GenerateButton variant="outline" label="outline" /><GenerateButton variant="ghost" label="ghost" /><GenerateButton variant="gradient" label="gradient" /></div>Glass (opt-in)
Glass is never the default. It needs a colorful or photographic backdrop to read.
<GenerateButton variant="glass" defaultGenerating label="Draft reply" generatingLabel="Drafting" />Hue, icon and loading
Custom hue and icon, plus the submitting state.
<GenerateButton hue={150} leadingIcon={<Rocket weight="fill" />} label="Deploy" /><GenerateButton loading />Accessibility
- Native button with the Button focus ring. Generating is never triggered by focus alone.
- Only the visible label is in the accessibility tree, so the name is never doubled.
- A polite status region announces the generating label.
Keyboard Interactions
| Key | Action |
|---|---|
| Enter | Requests the next state. |
| Space | Requests the next state. |
ARIA Attributes
- `aria-busy` while generating or loading
- `role=status` live region with the generating label
- `data-generating` for styling hooks
Reduced Motion
Full motion sweeps a highlight across the label and pulses the sparkle. Subtle and none keep a static glow and the label swap only.
Affected properties
text sweepsparkle pulseAPI Reference
GenerateButton
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
variant | "glinr" | "solid" | "plain" | "soft" | "outline" | "ghost" | "gradient" | "glass" | - | ambient (glinr) | Surface from the shared vocabulary. Omit for the ambient default. Glass is opt-in and needs a backdrop. |
tone | "neutral" | "accent" | "success" | "warning" | "danger" | "info" | - | neutral | Colour axis. |
size | "xs" | "sm" | "md" | "lg" | "icon" | No | md | Height and type size. |
label | string | No | Generate | Idle label. |
generatingLabel | string | No | Generating | Label shown and announced while generating. |
isGenerating | boolean | No | - | Controlled generating state. |
defaultGenerating | boolean | No | false | Initial state when uncontrolled. |
onGeneratingChange | (generating: boolean) => void | No | - | Called with the requested next state on activation. |
loading | boolean | No | false | Spinner, aria-busy and disabled. Separate from the generating glow. |
hue | number | No | 250 | Highlight hue from 0 to 360. |
leadingIcon | React.ReactNode | No | - | Replaces the sparkle. |
trailingIcon | React.ReactNode | No | - | Decorative icon after the label. |
asChild | boolean | - | false | Render onto the single child element. |
children | React.ReactElement | No | - | With `asChild`, pass the element to render, for example an anchor. |
Source
Import directly from the package or browse the source on GitHub. Click any file to view it.
Import
import { GenerateButton } from "@glinui/ui"Dependencies
@glinui/ui@glinui/motionclass-variance-authority@phosphor-icons/reactGenerated API Snapshot
Beta
Generated API Snapshot
BetaAuto-extracted from TypeScript source in packages/ui/src/components/generate-button.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.
Generated: 2026-10-08T01:41:21.546Z · Full index: /docs/api-metadata
Primary Props Type
GenerateButtonProps
GenerateButtonProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
children | React.ReactElement | No | - | With `asChild`, pass the element to render, for example an anchor. |
defaultGenerating | boolean | No | false | Initial generating state when uncontrolled. |
generatingLabel | string | No | "Generating" | Label shown (and announced) while generating. |
hue | number | No | - | Highlight hue, 0 to 360. Defaults to a violet-blue. |
isGenerating | boolean | No | - | Controlled generating state. |
label | string | No | "Generate" | Idle label. |
leadingIcon | React.ReactNode | No | - | Icon before the label. Defaults to a sparkle. |
loading | boolean | No | false | Submitting state: spinner, aria-busy and a disabled button (separate from the generating glow). |
onGeneratingChange | (generating: boolean) => void | No | - | Called with the requested next state when the button is activated. |
size | "xs" | "sm" | "md" | "lg" | "icon" | No | "md" | Variant option from generateButtonVariants. |
trailingIcon | React.ReactNode | No | - | Icon after the label. |