FormComponentsSubmit Button

Submit Button

SubmitButton is a reusable button component for Shaddy Form that supports loading and disabled states.

SubmitButton is a reusable button component designed for use within a Shaddy Form. It accepts all generic button props, supports loading and disabled states, and allows for custom labels and icons. Use this button inside a Shaddy Form to submit form data.

Installation

pnpm dlx shadcn@latest add https://shaddy-docs.vercel.app/r/submit-button

Props

NameTypeDefaultDescription
isLoadingbooleanfalseShows loading state and disables the button when true.
disabledbooleanfalseDisables the button when true.
labelstring"Save Changes"The text displayed on the button.
loadingLabelstring"Saving..."The text displayed when loading.
iconReactNodeIcon to display before the label.
loadingIconReactNodeIcon to display when loading.
classNamestringAdditional CSS classes for the button.
...Button propsAll props from your Button componentInherits all other props from your Button.

Usage

import { ShaddyForm, TextField, SubmitButton } from "@/components";
 
function MyForm() {
  return (
    <ShaddyForm>
      <div className="space-y-4">
        <TextField
          name="email"
          label="Email"
          required
          placeholder="Enter your email"
        />
        <SubmitButton
          label="Submit"
          loadingLabel="Submitting..."
          isLoading={false}
        />
      </div>
    </ShaddyForm>
  );
}