Pulse
Mantine

Date Pickers

Date and time input components from @mantine/dates

Date and time components from @mantine/dates. These components provide calendar-based date selection, time pickers, and datetime inputs with full form integration.

Available Components

Input Components

For use in forms with name prop support:

ComponentDescription
DateInputText input that parses typed date strings
DatePickerInputDate picker with dropdown calendar
DateTimePickerCombined date and time picker
TimeInputSimple time input field
TimePickerTime picker with dropdown
MonthPickerInputMonth/year selection input
YearPickerInputYear selection input

Picker Components

Inline picker components (no input wrapper):

ComponentDescription
DatePickerCalendar for selecting dates
MonthPickerMonth/year selector
YearPickerYear selector

Calendar Components

ComponentDescription
CalendarFull calendar display
MiniCalendarCompact calendar view

Basic Usage

DatePickerInput

The most common date input component:

from pulse_mantine import MantineProvider, DatePickerInput, Stack

@ps.component
def DateForm():
    return MantineProvider()[
        Stack(gap="md")[
            DatePickerInput(
                label="Select date",
                placeholder="Pick a date",
                name="date",
            ),
        ]
    ]

DateTimePicker

For selecting both date and time:

from pulse_mantine import DateTimePicker

DateTimePicker(
    label="Meeting time",
    placeholder="Select date and time",
    name="meeting_time",
)

TimeInput

For time-only input:

from pulse_mantine import TimeInput

TimeInput(
    label="Start time",
    placeholder="HH:MM",
    name="start_time",
)

Form Integration

Date pickers integrate with MantineForm using the name prop for automatic form registration.

Basic Form Example

import pulse as ps
from pulse_mantine import (
    MantineProvider, MantineForm, DatePickerInput,
    TextInput, Button, Stack,
)

@ps.component
def EventForm():
    form = MantineForm(
        initialValues={"title": "", "date": None},
        validateInputOnBlur=True,
    )

    def handle_submit(data):
        print(f"Event: {data['title']} on {data['date']}")

    return MantineProvider()[
        form.render(onSubmit=handle_submit)[
            Stack(gap="md")[
                TextInput(label="Event title", name="title"),
                DatePickerInput(
                    label="Event date",
                    placeholder="Select date",
                    name="date",
                ),
                Button("Create Event", type="submit"),
            ]
        ]
    ]

Date Validators

Pulse Mantine provides validators for date fields:

ValidatorDescription
IsDate()Validates that value is a parseable date
IsBefore(field=..., value=...)Date must be before another field or fixed value
IsAfter(field=..., value=...)Date must be after another field or fixed value

Date Range with Validation

from pulse_mantine import (
    MantineProvider, MantineForm, DatePickerInput,
    Button, Stack, IsNotEmpty, IsDate, IsBefore, IsAfter,
)

@ps.component
def DateRangeForm():
    form = MantineForm(
        initialValues={"start_date": None, "end_date": None},
        validate={
            "start_date": [IsNotEmpty("Start date is required"), IsDate()],
            "end_date": [
                IsNotEmpty("End date is required"),
                IsDate(),
                IsAfter("start_date", error="End date must be after start date"),
            ],
        },
        validateInputOnBlur=True,
    )

    def handle_submit(data):
        print(f"Range: {data['start_date']} to {data['end_date']}")

    return MantineProvider()[
        form.render(onSubmit=handle_submit)[
            Stack(gap="md")[
                DatePickerInput(
                    label="Start date",
                    placeholder="Select start",
                    name="start_date",
                ),
                DatePickerInput(
                    label="End date",
                    placeholder="Select end",
                    name="end_date",
                ),
                Button("Submit", type="submit"),
            ]
        ]
    ]

Examples

Simple Date Picker

from pulse_mantine import MantineProvider, DatePickerInput

@ps.component
def SimpleDatePicker():
    return MantineProvider()[
        DatePickerInput(
            label="Birth date",
            placeholder="Select your birth date",
            valueFormat="MMMM D, YYYY",
            clearable=True,
        )
    ]

DateTime Picker with Constraints

from datetime import datetime
from pulse_mantine import MantineProvider, DateTimePicker

@ps.component
def AppointmentPicker():
    return MantineProvider()[
        DateTimePicker(
            label="Appointment",
            placeholder="Pick date and time",
            minDate=datetime.now(),  # No past dates
            valueFormat="DD MMM YYYY hh:mm A",
        )
    ]

Inline Calendar

For displaying a calendar without an input wrapper:

from pulse_mantine import MantineProvider, DatePicker

@ps.component
def InlineCalendar():
    return MantineProvider()[
        DatePicker(
            type="range",  # Allow range selection
            numberOfColumns=2,  # Show two months
        )
    ]

Configuration

Common Props

All date picker components support these props:

PropTypeDescription
labelstrInput label
placeholderstrPlaceholder text
valueFormatstrDate format string (dayjs format)
minDatedatetimeMinimum selectable date
maxDatedatetimeMaximum selectable date
clearableboolShow clear button
disabledboolDisable the input
requiredboolMark as required
errorstrError message to display

Value Format

The valueFormat prop uses dayjs format tokens:

# Examples
DatePickerInput(valueFormat="YYYY-MM-DD")      # 2024-01-15
DatePickerInput(valueFormat="MMMM D, YYYY")    # January 15, 2024
DatePickerInput(valueFormat="DD/MM/YYYY")      # 15/01/2024
DateTimePicker(valueFormat="DD MMM YYYY HH:mm") # 15 Jan 2024 14:30

Locale Support

Wrap your app with DatesProvider to configure locale settings:

from pulse_mantine import MantineProvider, DatesProvider, DatePickerInput

@ps.component
def LocalizedApp():
    return MantineProvider()[
        DatesProvider(settings={"locale": "de", "firstDayOfWeek": 1})[
            DatePickerInput(label="Datum", placeholder="Datum auswahlen"),
        ]
    ]

Available settings:

SettingDescription
localeLocale string (e.g., "en", "de", "fr")
firstDayOfWeekFirst day of week (0=Sunday, 1=Monday)
weekendDaysArray of weekend day indices
timezoneTimezone for date calculations

Reference

For complete prop documentation and examples, see the Mantine Dates documentation.

On this page