# check out https://www.dash-mantine-components.com/ for documentation
# or https://github.com/snehilvj/dash-mantine-components for GitHub
from datetime import date
from dash import Dash, Input, Output, callback, html, dcc
import dash
from dash.exceptions import PreventUpdate
import dash_mantine_components as dmc
stylesheets = ["https://unpkg.com/@mantine/dates@7/styles.css"]
dash._dash_renderer._set_react_version('18.2.0')
app = Dash(__name__, external_stylesheets=stylesheets)
app.layout = dmc.MantineProvider(
[
dcc.Markdown("""
# Demo of dash-mantine-components
Demo taken from [dash-mantine-component GitHub](https://github.com/snehilvj/dash-mantine-components)
""", link_target="_blank"),
dmc.DatePicker(
id="date-picker",
label="Start Date",
description="You can also provide a description",
minDate=date(2020, 8, 5),
value=None,
w=200
),
dmc.Space(h=10),
dmc.Text(id="selected-date"),
]
)
@callback(Output("selected-date", "children"), Input("date-picker", "value"))
def update_output(d):
prefix = "You have selected: "
if d:
return prefix + d
else:
raise PreventUpdate
if __name__ == "__main__":
app.run_server(debug=True)