• CMSnpm version

    • Overview
    • ContentBuilder
    • InviteUserForm
    • LoginForm
    • RenewPasswordForm
  • UInpm version

    • Overview
    • Accordion
    • AlertBubble
    • AnnouncementBar
    • Avatar
    • AvatarFileInput
    • Badge
    • Button
    • ButtonGroup
    • ButtonList
    • Calendar
    • Checkbox
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • Chip
    • ColorRadio
    • ColorRadioGroup
    • Combobox
    • DatePicker
    • DatePickerInput
    • DateRangePicker
    • DateRangePickerInput
    • DatetimePicker
    • DatetimePickerInput
    • Dialog
    • Dropdown
    • Dropzone
    • ErrorMessage
    • FileInput
    • FlashMessages
    • FormComponent
    • Icon
    • IconButton
    • ImageGallery
    • InfoBox
    • Input
    • Label
    • Layout
    • Lightbox
    • ListItem
    • Loader
    • Lozenge
    • Menu
    • Message
    • Modal
    • ✅ ModalDialog
    • ✅ ModalHeader
    • MultiCombobox
    • MultiSelect
    • Pagination
    • Paper
    • Popover
    • Radio
    • RadioGroup
    • RasterImage
    • Select
    • ✅ Tabs
    • TextInput
    • TextLink
    • Textarea
    • TimePicker
    • TimePickerInput
    • Toggle
    • Tooltip
    • Typography
  • Formnpm version

    • Overview
    • AvatarFileInput
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • ColorRadioGroup
    • Combobox
    • DatePickerInput
    • DateRangePickerInput
    • DatetimePickerInput
    • Dropzone
    • FileInput
    • Form
    • FormRenderer
    • GpsInput
    • MoneyInput
    • MultiCombobox
    • MultiSelect
    • NumberInput
    • PasswordInput
    • RadioGroup
    • Select
    • TextInput
    • Textarea
    • TimePickerInput
    • Toggle
  • DataGridnpm version

    • Overview
    • DataGrid
    • DataGridCustomExample
    • ExportButton
    • FilterList
    • Filters
    • FiltersButton
    • FulltextInput
    • HiddenColumns
    • HiddenColumnsButton
    • Pagination
    • RowCounts
    • RowsPerPageSelect
    • SelectedRowsToolbar
    • TableV2
    • ToolbarControl
    • ToolbarCustoms
    • ToolbarTabs
  • Wysiwygnpm version

    • Overview
  • Resizernpm version

    • Overview
  • Routernpm version

    • Overview
  • Corenpm version

    • Overview
  • Core-Reactnpm version

    • Overview
  • Stylesnpm version

    • Overview
  • Localizenpm version

    • Overview
  • Analyticsnpm version

    • Overview
  • Datepickernpm version

    • Overview
  • Icons-generatornpm version

    • Overview
  • Smart-addressnpm version

    • Overview
  • E2Enpm version

    • Overview
  • E2E-Playwrightnpm version

    • Overview
View source on GitLab

DatePickerInput

react-hook-form-bound single-date field. Wraps the @uxf/ui/date-picker-input primitive and manages its value, isInvalid, and helperText from form state.

When to use

Use @uxf/form/date-picker-input for a date field inside a @uxf/form form — it registers the field with react-hook-form via control/name and renders validation errors automatically. For a standalone, manually-controlled date input (outside a form), use the @uxf/ui/date-picker-input twin directly. For a date range use @uxf/form/date-range-picker-input.

Usage

import { DatePickerInput, DatePickerInputValue } from "@uxf/form/date-picker-input";
import { Form } from "@uxf/form/form";
import { useForm } from "react-hook-form";

interface FormData {
    date: DatePickerInputValue;
}

function Example() {
    const formApi = useForm<FormData>({ defaultValues: { date: null } });

    return (
        <Form formApi={formApi} id="example" onSubmit={(values) => console.log(values)}>
            <DatePickerInput control={formApi.control} isClearable isRequired label="Date" name="date" />
        </Form>
    );
}

Value

DatePickerInputValue = string | null — an ISO date string in OUTPUT_DATE_FORMAT ("YYYY-MM-DD"), or null when empty. This is what is stored in the form values (and what min/max validation compares against). The input still displays the value using displayDateFormat (default "D. M. YYYY"); see the twin for display/parsing details.

Props

DatePickerInputProps<FormData> = ControlProps<FormData> + the visual props of the @uxf/ui/date-picker-input twin (minus the ones this field manages: isFocused, isInvalid, max, min, name, onChange, pattern, step, value) + the field-specific props below.

Prop Type Default Description
control Control<FormData> — Required. The control from useForm.
name FieldPath<FormData> — Required. Field path in the form values.
rules RegisterOptions — Extra react-hook-form rules; merged with the built-in validation below.
shouldUnregister boolean — Unregister the field (drop its value) on unmount.
isRequired boolean false Adds a required rule and the required indicator.
requiredMessage string localized Message for the required rule.
minDate string — Earliest allowed date, ISO YYYY-MM-DD; constrains the calendar and adds a min-date validation.
maxDate string — Latest allowed date, ISO YYYY-MM-DD; constrains the calendar and adds a max-date validation.
onChange (value: string | null, event?) => void — Called after the field value updates.

All other props (label, placeholder, size, variant, helperText, isClearable, displayDateFormat, allowedDateFormats, datesConfig, triggerElement, leftAddon/rightAddon/leftElement/rightElement, bottomContent, popoverPlacement/popoverStrategy, …) are forwarded to the twin — see @uxf/ui/date-picker-input. id defaults to `${formId}__${name}`.

Validation

Built-in rules (messages come from the uxf-form-date-picker-input:validation.* translations; override the required one with requiredMessage):

  • required — when isRequired.
  • valid date format — a non-empty value must parse strictly as YYYY-MM-DD, otherwise invalid-date-format (interpolates the displayDateFormat).
  • min-date / max-date — when minDate / maxDate is set and the value falls outside the range.
  • Add further rules via rules; a function rules.validate is merged under the custom key. The field-level error is shown as the twin's helperText and sets isInvalid.

Requirements

  • Must be rendered inside a Form — it reads the form context (formId, and inherits isDisabled / isReadOnly) and needs a react-hook-form control.
  • Ships no CSS of its own; it renders @uxf/ui/date-picker-input, so include that component's stylesheet(s) and the @uxf/ui token layer — see @uxf/ui/date-picker-input.

Links

  • Visual/primitive twin: @uxf/ui/date-picker-input
Default
Open in new tab