Sizes
<Input size="sm" placeholder="Size sm" /><Input size="md" placeholder="Size md" />Input with icons
<Input
type="email"
placeholder="email"
leftIcon={Mail01}
/><Input
type="email"
placeholder="email"
rightIcon={Mail01}
/>Input with tooltip
<Input
type="text"
placeholder="Input with tooltip"
tooltip="Input with tooltip"
/>Payment Input
Specialized input for credit card numbers with automatic card type detection.
<PaymentInput placeholder="Card number" /><PaymentInput placeholder="Card number" size="md" />OTP Input
Verification code input components built for modern applications and websites.
0
0
0
0
<InputOTP size="sm" slots={4} maxLength={4} />0
0
0
-
0
0
0
<InputOTP slots={6} maxLength={4} separator />InputGroup
<InputGroup
type="text"
leftAddon={<InputAffix>https://</InputAffix>}
rightAddon={<InputAffix>.com</InputAffix>}
size="sm"
tooltip="This is a tooltip"
/>
<InputGroup
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
setValue(e.target.value)
}
type="text"
rightAddon={
<InputAffix
onClick={() => copy(value || "Copied")}
className={cn(
"flex items-center gap-1 bg-primary text-secondary hover:bg-primary_hover hover:text-secondary_hover cursor-pointer"
)}
>
{copied ? (
<Check className="size-4" />
) : (
<Copy01 className="size-4" />
)}
Copy
</InputAffix>
}
size="sm"
tooltip="This is a tooltip"
/>
<InputGroup
leftAddon={
<NativeSelect
aria-label="Country"
options={[
{ value: "US", label: "US" },
{ value: "CA", label: "CA" },
{ value: "EU", label: "EU" },
]}
/>
}
type="tel"
placeholder="+1 (555) 000-0000"
/>$
<InputGroup
prefix="$"
rightAddon={
<NativeSelect
aria-label="Currency"
options={[
{ value: "USD", label: "US" },
{ value: "CAD", label: "CA" },
{ value: "EUR", label: "EU" },
]}
/>
}
type="tel"
placeholder="1,000.00"
/>Form
import { useForm } from "react-hook-form";
import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
const formSchema = z.object({
username: z.string().min(2, { message: "Username must be at least 2 characters." }),
email: z.string().email(),
cardNumber: z.string().min(13, { message: "Card number must be at least 13 digits." }),
code: z.string().min(6, {
message: "Your one-time password must be 6 characters.",
}),
});
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: { username: "", email: "", cardNumber: "", code: "" },
});
function onSubmit(data: z.infer<typeof formSchema>) {
toast("You submitted the following values", {
description: (
<pre className="mt-2 w-[320px] rounded-md bg-neutral-950 p-4">
<code className="text-white">{JSON.stringify(data, null, 2)}</code>
</pre>
),
});
}
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="w-2/3 space-y-6">
<InputForm
control={form.control}
name="username"
label="Username"
placeholder="shadcn"
description="This is your public display name."
leftIcon={User02}
tooltip="This is a tooltip"
isRequired
/>
<InputForm
control={form.control}
type="email"
name="email"
label="Email"
placeholder="Your email"
description="This is your login email."
leftIcon={Mail02}
tooltip="This is a tooltip"
isRequired
/>
<PaymentInputForm
control={form.control}
name="cardNumber"
label="Card Number"
placeholder="1234 5678 9012 3456"
description="Enter your credit card number."
isRequired
/>
<InputOTPForm
name="code"
control={form.control}
label="Code de vérification"
description="Entrez le code"
slots={6}
separator={true}
isRequired
/>
<Button type="submit">Submit</Button>
</form>
</Form>API Reference
INPUT (Props additionnels à Input HTML)
| Props | Type | Default | Description |
|---|---|---|---|
| size? | "sm" | "md" | "sm" | Controls input padding. |
| leftIcon? | React.FC<SVGProps> | — | Icon displayed on the left. |
| rightIcon? | React.F<SVGProps> | — | Icon displayed on the right. |
| tooltip? | string | — | Tooltip message on hover/focus. |
| inputWrapperClassName? | string | — | Styles for the outer wrapper. |
| inputClassName? | string | — | Styles for the native input. |
| iconClassName? | string | — | Styles for icons. |
| tooltipClassName? | string | — | Styles for tooltip content. |
INPUT GROUP
| Props | Type | Default | Description |
|---|---|---|---|
| leftAddon? | ReactNode | — | Addon before input. |
| rightAddon? | ReactNode | — | Addon after input. |
| size? | "sm" | "md" | "sm" | Controls input padding. |
| tooltip? | string | — | Tooltip message on hover/focus. |
| inputGroupClassName? | string | — | Styles for the group container. |
| inputWrapperClassName? | string | — | Styles passed to the inner Input wrapper. |
| inputClassName? | string | — | Extra classes applied to the native input. |
INPUT AFFIX
| Props | Type | Default | Description |
|---|---|---|---|
| isDisabled? | boolean | false | Visual disabled state for the addon. |
| children | ReactNode | — | Addon content. |
INPUT FORM
| Props | Type | Default | Description |
|---|---|---|---|
| control | Control<TFieldValues> | — | React Hook Form control instance. |
| name | FieldPath<TFieldValues> | — | Field name registered in the form schema. |
| label? | ReactNode | string | — | Field label displayed above input. |
| description? | ReactNode | string | — | Helper text under the input. |
| isRequired? | boolean | false | Adds "required" indicator on label. |
| …inputProps | All Input props (except name) | — | Pass-through to the inner Input. |
PAYMENT INPUT FORM
| Props | Type | Default | Description |
|---|---|---|---|
| control | Control<TFieldValues> | — | React Hook Form control instance. |
| name | FieldPath<TFieldValues> | — | Field name registered in the form schema. |
| label? | ReactNode | string | — | Field label displayed above input. |
| description? | ReactNode | string | — | Helper text under the input. |
| isRequired? | boolean | false | Adds "required" indicator on label. |
| tooltip? | string | — | Tooltip message on hover/focus. |
| tooltipClassName? | string | — | Styles for tooltip content. |
INPUT OTP
| Props | Type | Default | Description |
|---|---|---|---|
| slots? | number | 6 | Number of input boxes to render. |
| size? | "sm" | "md" | "lg" | "md" | Controls the size of each input slot. |
| separator? | boolean | number[] | false | If true, adds a separator in the middle (if slots are even). Can be an array of positions (e.g., [3, 6]). |
| maxLength? | number | slots | Maximum characters allowed. Defaults to slots. |
| disabled? | boolean | false | Disables user input. |
| containerClassName? | string | — | Extra classes for the flex container wrapping the slots. |
| inputClassName? | string | — | Extra classes for the underlying invisible<input> element (used for keyboard and paste handling). |
INPUT OTP FORM
| Props | Type | Default | Description |
|---|---|---|---|
| control | Control<TFieldValues> | — | React Hook Form control instance. |
| name | FieldPath<TFieldValues> | — | Field name registered in the form schema. |
| label? | ReactNode | string | — | Field label displayed above input. |
| description? | ReactNode | string | — | Helper text under the input. |
| isRequired? | boolean | false | Adds required indicator on label. |
| slots? | number | 6 | Number of input boxes to render. |
| size? | "sm" | "md" | "lg" | "md" | Controls the size of each input slot. |
| maxLength? | number | slots | Maximum characters allowed. |
| renderSlots? | (slots: number) => React.ReactNode | — | Custom rendering function for slots and separators. |
| …otpProps | All InputOTP props (except value and onChange). | — | Props passed to the inner InputOTP component. |