# Date picker (UI SDK): Form

> With a `name`, the date submits as an ISO string. `required` blocks an empty submit, text that isn’t a date blocks one too, and reset goes back to `defaultValue`.

Canonical: https://hextaui.com/docs/ui-sdk-date-picker/examples/form

Component docs: https://hextaui.com/docs/ui-sdk-date-picker

## Add this example

```bash
npx shadcn@latest add https://hextaui.com/r/ui-sdk-date-picker-form.json
```

This adds `components/examples/ui-sdk-date-picker/form.tsx` with the Date picker component and the HextaUI theme tokens.

## Source

```tsx title="components/examples/ui-sdk-date-picker/form.tsx"
"use client"

import * as React from "react"

import { Button } from "@/components/ui/button"
import {
  DatePicker,
  DatePickerContent,
  DatePickerControl,
  DatePickerHint,
  DatePickerInput,
  DatePickerTrigger,
} from "@/components/ui/ui-sdk-date-picker"

function UiSdkDatePickerForm() {
  const [submitted, setSubmitted] = React.useState<string | null>(null)

  return (
    <form
      className="flex w-full max-w-56 flex-col gap-3"
      onSubmit={(event) => {
        event.preventDefault()
        const data = new FormData(event.currentTarget)
        setSubmitted(String(data.get("start")))
      }}
    >
      <DatePicker name="start" required>
        <DatePickerControl>
          <DatePickerInput aria-label="Start date" />
          <DatePickerTrigger />
        </DatePickerControl>
        <DatePickerHint />
        <DatePickerContent />
      </DatePicker>
      <div className="flex items-center gap-3">
        <Button type="submit" size="sm">
          Submit
        </Button>
        <Button type="reset" size="sm" variant="ghost">
          Reset
        </Button>
      </div>
      <p className="text-sm text-muted-foreground tabular-nums">
        {submitted ? `Submitted ${submitted}` : "Nothing submitted yet."}
      </p>
    </form>
  )
}

export { UiSdkDatePickerForm }
```

## Props in this example

### DatePicker

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `name` | `string` | – |  |
| `required` | `boolean` | `false` |  |

## More Date picker examples

- [Range](https://hextaui.com/docs/ui-sdk-date-picker/examples/range)
- [Presets](https://hextaui.com/docs/ui-sdk-date-picker/examples/presets)
- [Min, max and unavailable dates](https://hextaui.com/docs/ui-sdk-date-picker/examples/limits)
- [Language](https://hextaui.com/docs/ui-sdk-date-picker/examples/locale)
- [Controller](https://hextaui.com/docs/ui-sdk-date-picker/examples/controller)
- [Disabled and read-only](https://hextaui.com/docs/ui-sdk-date-picker/examples/disabled)
- [Right to left](https://hextaui.com/docs/ui-sdk-date-picker/examples/rtl)
