Installation
Props
FluxButton
12 props
Async button with idle, loading, and success states, plus b-button visual variants.
idleLabel
stringRequired
Label shown before the action starts.
loadingLabel
stringRequired
Label shown with the built-in loader while onAction is in progress.
successLabel
stringRequired
Label shown after onAction resolves.
successIcon
React.ReactNodeOptional icon shown on success. Pass any node, such as a Lucide checkmark. Omit for text-only success.
onAction
() => void | Promise<void>Required
Runs when the button is pressed, drives loading and success states, then returns to idle after successHold.
variant
"default" | "outline" | "secondary" | "ghost" | "destructive" | "link"Default
defaultVisual style variant. Matches the b-button variant set.
successHold
numberDefault
1000Milliseconds to hold the success state before returning to the idle label.
size
"xs" | "sm" | "default" | "lg"Default
defaultHeight and horizontal padding preset. Matches b-button sizes.
type
"button" | "submit"Default
buttonNative button type. Use submit inside forms; defaults to button so the control does not submit unless you opt in.
disabled
booleanDefault
falseNative disabled state. Also blocks the action flow while true.
className
stringOptional class names merged onto the root button element.
onClick
React.MouseEventHandler<HTMLButtonElement>Native click handler forwarded to the underlying button.
Notes
Built on `@base-ui/react/button` with a Motion render surface, matching the b-button integration pattern.
Locks interaction while loading or showing success without applying disabled opacity, using aria-disabled and pointer-events-none instead.
Motion transitions start only after the first click, so the button renders statically on page load.
Install path is `components/ui/flux-button.tsx` with the `FluxButton` export.