Calendar Input
A form-ready date input that combines a text field with a calendar popover. Used by RenderFormFields for ColumnTypeEnum.DATE and ColumnTypeEnum.DATETIME fields.
Import
import { CalendarInput } from "@phpcreation/frontend-components-react-nextjs-bundle/components/CalendarInput";Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | Date | undefined | — | Controlled date value |
onChange | (value: string) => void | — | Change handler (ISO string) |
placeholder | string | "Pick a date" | Input placeholder |
disabled | boolean | false | Disable the input |
format | string | "PPP" | date-fns format string |
className | string | — | Additional CSS classes |
Usage
import { CalendarInput } from "...";
<CalendarInput
value={dueDate}
onChange={setDueDate}
placeholder="Select due date..."
/>With React Hook Form
<FormField
control={form.control}
name="dueDate"
render={({ field }) => (
<FormItem>
<FormLabel>Due Date</FormLabel>
<FormControl>
<CalendarInput
value={field.value}
onChange={field.onChange}
placeholder="Pick a date"
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>Related
- Calendar — raw calendar panel
- Time Picker — for time-only fields
- Form (RHF)
- Render Form Fields
Last updated on