Xzero UI
Pro library

Action button

A compact button for frequent toolbar actions.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/action-button
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/action-button

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { ActionButton } from "@/components/xzero/action-button/action-button";

export function PublishButton() {
  return (
    <ActionButton
      label="Publish"
      pendingLabel="Publishing"
      successLabel="Published"
      onAction={publish}
      onActionError={error => toast.error(String(error))}
    />
  );
}

API reference

ActionButton

A call-to-action button with a trailing arrow that runs an async action and morphs through pending and success.

PropTypeDefaultDescription
label (required)string–Idle label and accessible name.
onAction (required)() => void | Promise<void>–Runs on press. The pending state lasts until the promise settles.
pendingLabelstring"Saving"Label while onAction runs.
successLabelstring"Saved"Label after onAction resolves.
resetAfterMsnumber2400Delay before returning to idle after success. 0 keeps the success state.
onActionError(error: unknown) => void–Called when onAction rejects; the button returns to idle.
...propsButtonHTMLAttributes<HTMLButtonElement>–Forwarded to the button, except onClick.

Keyboard interactions

KeysAction
Enter / SpaceRuns the action.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in buttons

Guidance for AI tools

Action button: A compact button for frequent toolbar actions. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components