# Date Picker

Date pickers pickers provide a simple way to select a single value from a pre-determined set.

Date pickers can be used in [Forms](/v1/dashboard/components/inputs/form.md) and [Steppers](/v1/dashboard/components/navigation/stepper.md).

![](/files/-MAgAdTcQRqqTqnMntHe)

```
New-UDDatePicker
```

## OnChange Event Handler

The OnChange event handler is called when the date changes. You can access the current date by using the `$Body` variable.

```
New-UDDatePicker -OnChange {
    Show-UDToast -Message $body
}
```

## Variant

You can customize how the date picker is show. The default is the `inline` variant that displays the date picker popup inline with the input control. You can also use the `dialog` variant that pops the date picker up in the middle of the screen. Finally, the `static` variant displays the date picker without having to click anything.

```
New-UDDatePicker -Variant static
```

**New-UDDatePicker**

| Name           | Type            | Description                                                                                       | Required |
| -------------- | --------------- | ------------------------------------------------------------------------------------------------- | -------- |
| Id             | String          | The ID of the component. It defaults to a random GUID.                                            | false    |
| Label          | String          | The label to show next to the date picker.                                                        | false    |
| Variant        | String          | The theme variant to apply to the date picker.                                                    | false    |
| DisableToolbar | SwitchParameter | Disables the date picker toolbar.                                                                 | false    |
| OnChange       | Endpoint        | A script block to call with the selected date. The $EventData variable will be the date selected. | false    |
| Format         | String          | The format of the date when it is selected.                                                       | false    |
| Value          | DateTime        | The current value of the date picker.                                                             | false    |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.powershelluniversal.com/v1/dashboard/components/inputs/date-picker.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
