inputs/DSDatePicker

DSDatePicker

inputs
since v2.0

Date (and optional time) picker with a calendar grid popover. Wraps the native DatePicker with DS token styling.

iOS 17+macOS 14+

Purpose

Date selection in forms: booking dates, deadlines, birthdays, scheduled tasks.

Props

PropTypeDefaultDescription
selectionreqBinding<Date>โ€”Bound date value.
labelString?nilField label.
displayedComponentsDatePickerComponents.date.date, .hourAndMinute, or both.
rangeClosedRange<Date>?nilRestricts selectable dates.
placeholderString"Select a date"Placeholder before a date is chosen.

Examples

Task deadline picker

Date field in a task creation form.

swift
DSDatePicker(
    selection: $taskDeadline,
    label: "Due date",
    range: Date.now...,
    displayedComponents: .date
)

Related Components