Input
An enhanced <input> that adds a label, helper text tooltip, error message display, and automatic password show/hide toggle.
Import
import { Input } from "@phpcreation/frontend-components-react-nextjs-bundle/components/Input";Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
label | string | — | — | Field label shown above the input |
required | boolean | — | false | Adds a required asterisk to the label |
helperText | string | — | — | Tooltip text shown on the info icon |
fieldIcon | ReactNode | — | — | Icon rendered inside the input (left side) |
errorMessage | string | — | — | Validation error shown below the input |
Plus all standard HTML <input> attributes (type, placeholder, value, onChange, etc.).
Usage
import { Input } from "@phpcreation/frontend-components-react-nextjs-bundle/components/Input";
// Basic text input
<Input
label="Company Name"
placeholder="Acme Corp"
required
/>
// With error
<Input
label="Email"
type="email"
errorMessage="Please enter a valid email address"
/>
// Password (eye toggle is automatic)
<Input
label="Password"
type="password"
helperText="Must be at least 8 characters"
/>With React Hook Form
import { useForm } from "react-hook-form";
import { Input } from "@phpcreation/frontend-components-react-nextjs-bundle/components/Input";
const { register, formState: { errors } } = useForm();
<Input
label="Name"
required
errorMessage={errors.name?.message}
{...register("name")}
/>Related
Last updated on