> For the complete documentation index, see [llms.txt](https://swift-packages.gitbook.io/materialuikit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://swift-packages.gitbook.io/materialuikit/components/date-selector.md).

# Date Selector

Represents a Material UI styled date selector for selecting dates.

### 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="https://2931569195-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHpwjDgYAa64eKF8AGmeE%2Fuploads%2FuXHFmWXZgiHhYdPGdHnT%2FDate%20Selctor%20Dark.png?alt=media&amp;token=3250ae7d-e5f1-40c2-8b67-ef7bba380c10" media="(prefers-color-scheme: dark)"><img src="https://2931569195-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHpwjDgYAa64eKF8AGmeE%2Fuploads%2FkRLGYYEJju4qNpVff9fB%2FDate%20Selctor%20Light.png?alt=media&amp;token=e392a41a-b25e-40c1-9fb0-c440e5318ac0" alt=""></picture><figcaption></figcaption></figure>
