New in the docs!
This feature has been available since dash-mantine-components==2.1.0, but was just added to the documentation thanks to first time contributor @EstanVW25 ![]()
DatePicker presets
DatePicker, DatePickerInput and DateTimePicker now support presets prop that allows you to add custom date presets. Presets are displayed next to the calendar:

from datetime import date, timedelta
from dateutil.relativedelta import relativedelta
from dash import Dash
import dash_mantine_components as dmc
today = date.today()
component = dmc.DatePicker(
id="datepicker-presets",
type="range",
presets=[
{
"value": [
(today - timedelta(days=2)).isoformat(),
today.isoformat(),
],
"label": "Last two days",
},
{
"value": [
(today - timedelta(days=7)).isoformat(),
today.isoformat(),
],
"label": "Last 7 days",
},
{
"value": [
today.replace(day=1).isoformat(),
today.isoformat(),
],
"label": "This month",
},
{
"value": [
(today - relativedelta(months=1)).replace(day=1).isoformat(),
(today.replace(day=1) - timedelta(days=1)).isoformat(),
],
"label": "Last month",
},
{
"value": [
date(today.year - 1, 1, 1).isoformat(),
date(today.year - 1, 12, 31).isoformat(),
],
"label": "Last year",
},
],
)
app = Dash()
app.layout = dmc.MantineProvider([
component,
])
if __name__ == "__main__":
app.run(debug=True)
