# Date picker (UI SDK): Controller

> A controller from `createDatePickerController()` sets the date or opens the calendar from anywhere, and `onValueChange` reports each change. Leave `value` unset here, so the calendar can move to the month the controller picks.

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

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-controller.json
```

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

## Source

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

import * as React from "react"

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

function UiSdkDatePickerController() {
  const [picker] = React.useState(createDatePickerController)
  const [value, setValue] = React.useState<DatePickerValue>(null)

  return (
    <div className="flex w-full max-w-56 flex-col gap-3">
      <DatePicker controller={picker} onValueChange={setValue}>
        <DatePickerControl>
          <DatePickerInput aria-label="Party date" />
          <DatePickerTrigger />
        </DatePickerControl>
        <DatePickerContent />
      </DatePicker>
      <div className="flex gap-2">
        <Button
          variant="outline"
          size="sm"
          onClick={() => picker.setValue("2026-12-25")}
        >
          Choose Christmas
        </Button>
        <Button variant="ghost" size="sm" onClick={() => picker.open()}>
          Open
        </Button>
      </div>
      <p className="text-sm text-muted-foreground tabular-nums">
        {typeof value === "string" ? value : "No date"}
      </p>
    </div>
  )
}

export { UiSdkDatePickerController }
```

## Props in this example

### DatePicker

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `onValueChange` | `(value, details) => void` | – |  |
| `controller` | `DatePickerController` | – | From createDatePickerController(). |

## 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)
- [Form](https://hextaui.com/docs/ui-sdk-date-picker/examples/form)
- [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)
