Skip to content
h v3.13.3
Search the docs
Find a component, section or page.

AI button

A sparkle button that shows a spinner while the model works.

Installation

pnpm add @heyramzi/ui

Usage

import { AiButton, type AiStatus } from "@heyramzi/ui/ai/ai-button";
<AiButton {status} label="Draft reply" processingLabel="Drafting..." onclick={draft} />
<AiButton iconOnly {status} onclick={draft} />

Keyboard and accessibility

Key Does
Space Enter Runs the action.
  • The icon button is named by label, then by processingLabel while it works.
  • While it works it reports disabled and ignores presses, and focus stays on it.
  • Nothing is read out when the work finishes. Change the label, as the demo does, or announce it yourself.

API reference

status "idle" | "processing" | "done"
Default "idle"
label string
Default "Generate"
processingLabel string
Default "Processing..."
variant ButtonProps["variant"]
Default "outline"
size ButtonProps["size"]
Default "sm"
disabled boolean
Default false
onclick (e: MouseEvent) => void
class string
iconOnly boolean
Default false
Prop Type Default
status "idle" | "processing" | "done" "idle"
label string "Generate"
processingLabel string "Processing..."
variant ButtonProps["variant"] "outline"
size ButtonProps["size"] "sm"
disabled boolean false
onclick (e: MouseEvent) => void
class string
iconOnly boolean false