# Date Selector

### Overview

The Date Selector provides a Material Design style date selector for selecting dates, presented as a modal overlay. It’s ideal for forms or settings where date selection is required. It adapts to different screen sizes and orientations, offering a flexible interface for date selection.&#x20;

To use the `dateSelector` modifier, apply it to any View with the required parameters. Below is the available method:

### Modifier

Presents a date selector with a binding to control the presentation state and a binding to manage the selected date.

```swift
dateSelector(isPresented:Binding<Bool>, selection: Binding<Date>)
```

### **Parameters**

<table><thead><tr><th width="184">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>isPresented</code></td><td>A binding to control the presentation state of the date selector.</td></tr><tr><td><code>selection</code></td><td>A binding to manage the selected date.</td></tr></tbody></table>

### Example

```swift
@State private var isDateSelectorPresented: Bool = false
@State private var selectedDate: Date = Date()

var body: some View {
    Container {
        Switch("Show Date Selector", isOn: $isDateSelectorPresented)
    }
    .dateSelector(isPresented: $isDateSelectorPresented, selection: $selectedDate)
}
```

<figure><picture><source srcset="/files/3lbOH81SF83jK6orCdcy" media="(prefers-color-scheme: dark)"><img src="/files/0OJ6a7c4MJBfCLLsVkbH" alt=""></picture><figcaption></figcaption></figure>


---

# 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://swift-packages.gitbook.io/materialuikit/components/date-selector.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.
