Phone Input Field
PhoneInputField is reusable phone number taking input.
PhoneInputField
is a reusable input component for Shaddy Form, designed for collecting and validating phone numbers. It integrates with react-hook-form
and supports labels, required state, and disabled state.
Installation
pnpm dlx shadcn@latest add https://shaddy-docs.vercel.app/r/phone-input-field
Props
Name | Type | Default | Description |
---|---|---|---|
name | string (from react-hook-form Path) | required | The field name (must match your form schema). |
label | string | The label displayed above the input. | |
required | boolean | false | Marks the field as required. |
disabled | boolean | false | Disables the input when true. |
className | string | Additional CSS classes for the field. |
Usage
<ShaddyForm>
<PhoneInputField
name="phone"
label="Phone Number"
required
placeholder="Enter your phone number"
/>
</ShaddyForm>
Notes
PhoneInputField
uses thePhoneInput
component for formatting and validation.