MaterialUIKit
Github
  • MaterialUIKit
  • Essentials
    • Configuring and Personalizing
    • Defining a Custom Color Schemes
  • Configuration and Color Schemes
    • MUIKitConfiguration
    • MUIKitColorScheme
  • Components
    • Action Button
      • ActionButtonStyle
    • Checkbox
    • Collection
      • CollectionStyle
    • Container
    • Date Selector
    • Dialog
    • Dialog Sheet
    • Dropdown Menu
      • Dropdown Menu Label
    • FAB
    • Icon Button
      • IconButtonStyle
    • Navigation Container
      • NavigationContainerHeaderStyle
      • Navigation Route
      • Navigation Route Label
    • Progress Bar
    • Radio Buttons Group
    • Search Box
    • Secure Text Box
    • Segmented Buttons
    • Separator
      • SeparatorOrientationStyle
    • Snackbar
    • Switch
    • Time Selector
    • Text Box
    • Tab Bar
      • TabBar Item
Powered by GitBook
On this page
  • Overview
  • Modifier
  • Parameters
  • Example
  1. Components

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.

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.

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

Parameters

Parameter
Description

isPresented

A binding to control the presentation state of the date selector.

selection

A binding to manage the selected date.

Example

@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)
}
PreviousContainerNextDialog

Last updated 10 months ago