Viora LogoViora UI
Login

Action Button

An animated action button with character-level spring transitions, drawn checkmark, and morphing width.

action-button.tsx
Loading source code...

Installation

npx viora-ui@latest add action-button
pnpm dlx viora-ui@latest add action-button
npx viora-ui@latest add action-button
bunx viora-ui@latest add action-button

Step 1: Install Dependencies

npm install motion lucide-react

Step 2: Copy the Source Code Copy action-button.tsx into your @/components/arc/action-button/ directory.

Usage

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

export function PublishButton() {
  const publish = async () => {
    await fetch("/api/publish", { method: "POST" });
  };

  return (
    <ActionButton
      label="Publish"
      pendingLabel="Publishing"
      successLabel="Published"
      onAction={publish}
      onActionError={(error) => console.error(error)}
    />
  );
}

Props

PropTypeDefaultDescription
labelstring—The resting label text.
pendingLabelstring"Saving"Text shown while the async action resolves.
successLabelstring"Saved"Text shown upon success with drawn tick.
onAction() => void | Promise<void>—Async handler triggered on click.
resetAfterMsnumber2400Delay in ms before returning to idle.
onActionError(error: unknown) => void—Callback triggered if onAction throws.
disabledbooleanfalseWhether button is disabled.

Built by Otis

Last updated: 10/12/2026