Skip to content

Submitting button in React

A button's state while a form is submitting: a small spinner and a "Sending" label.

Here is an excerpt of this component's code in React. The full code is free for members, ready to copy into your project.

This component also comes in

Open in a new tab

The code in React

SubmittingButton.tsx
export function SubmittingButton() {
  return (
    <div className="grid justify-items-center gap-3.5">
      <button
        type="button"
        aria-disabled="true"
        className="inline-flex min-h-12 cursor-progress items-center gap-2.5 rounded-xl bg-green-700 px-6 font-bold text-white opacity-90 focus-visible:outline-3 focus-visible:outline-offset-2 focus-visible:outline-green-900 dark:bg-green-300 dark:text-green-950 dark:focus-visible:outline-green-200"
      >
        <span
          aria-hidden="true"
          className="size-4.5 animate-spin rounded-full border-[2.5px] border-current border-r-transparent [animation-duration:0.7s] motion-reduce:[animation-duration:2.1s]"
        ></span>

Free component: copy it freely, including for commercial projects.

Loaders components in React
  • Three dots bouncing one after another, for a short wait or a message being typed.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A thin bar where a segment slides continuously, for a load of unknown duration.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A spinning ring with a colored segment, alongside a loading text.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component