Py.Cafe

namakshenas/

dmc-type-grid

Dash Mantine Grid Layout

DocsPricing
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import dash_mantine_components as dmc
from dash import Dash, html, _dash_renderer

_dash_renderer._set_react_version("18.2.0")

app = Dash(external_stylesheets=dmc.styles.ALL)

style = {
    "border": f"1px solid {dmc.DEFAULT_THEME['colors']['indigo'][4]}",
    "textAlign": "center",
}

component = html.Div(
    dmc.Grid(
        children=[
            dmc.GridCol(html.Div("1", style=style), span={"base": 12, "md": 6, "lg": 3}),
            dmc.GridCol(html.Div("2", style=style), span={"base": 12, "md": 6, "lg": 3}),
            dmc.GridCol(html.Div("3", style=style), span={"base": 12, "md": 6, "lg": 3}),
            dmc.GridCol(html.Div("4", style=style), span={"base": 12, "md": 6, "lg": 3}),
            dmc.GridCol(html.Div("5", style=style), span={"base": 12, "md": 6, "lg": 3}),
        ],
        gutter="xl",
        type="container",
        breakpoints={
            "xs": "100px",
            "sm": "200px",
            "md": "300px",
            "lg": "400px",
            "xl": "500px",
        },
    ),
    style={"resize": 'horizontal', "overflow": 'hidden', "maxWidth": '100%', "margin": 24 },
)

app.layout = dmc.MantineProvider([component])

if __name__ == "__main__":
    app.run(debug=True)