VitNode
Forms

Date Picker

Renders a date picker or an element designed to resemble a date picker.

Preview

Usage

import { z } from 'zod';
import { AutoForm } from 'vitnode-frontend/form/auto-form';
import { AutoFormDatePicker } from 'vitnode-frontend/form/fields/date';
const formSchema = z.object({
  birthday: z.date().default(new Date()),
});
<AutoForm
  formSchema={formSchema}
  fields={[
    {
      id: 'birthday',
      component: AutoFormDatePicker,
    },
  ]}
/>

Examples

Controlled Month and Year

Enable dropdown for month and year.

<AutoForm
  formSchema={formSchema}
  fields={[
    {
      id: 'birthday',
      component: props => (
        <AutoFormDatePicker
          {...props}
          fromYear={1900}
          toYear={new Date().getFullYear()}
        />
      ),
    },
  ]}
/>

API Reference

PropTypeDefault
onChange
(value: Date | undefiend) => void;
-
value
Date | undefiend
-
disabled
boolean
-
controlledMouthAndYear
{ fromYear: number; toYear: number; }
-

On this page