FormComponentsReset Button

Reset Button

ResetButton is a reusable button component for Shaddy Form that resets form data.

⚠️ This content is not available in your language yet.

ResetButton is a reusable button component designed for use within a Shaddy Form. It accepts all generic button props, a custom label, and integrates with react-hook-form to reset the form state. Use this button inside a Shaddy Form to clear all form fields.

Installation

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

Props

NameTypeDefaultDescription
labelstring"Reset"The text displayed on the button.
disabledbooleanfalseDisables the button when set to true.
classNamestringAdditional CSS classes for the button.
onClick(e: React.MouseEvent) => voidOptional click handler (called after reset).
...Button propsAll props from your Button componentInherits all other props from your Button.

Usage

import { ShaddyForm, TextField, ResetButton } from "@/components";
 
function MyForm() {
  return (
    <ShaddyForm>
      <div className="space-y-4">
        <TextField
          name="email"
          label="Email"
          required
          placeholder="Enter your email"
        />
        <ResetButton label="Reset" />
      </div>
    </ShaddyForm>
  );
}