Py.Cafe

amward/

dash-mantine-checkbox-icons

dmc.Checkbox with Custom Icons

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
39
40
41
42
import dash_mantine_components as dmc
from dash import Dash, _dash_renderer, Input, Output, State
_dash_renderer._set_react_version("18.2.0")
from dash_iconify import DashIconify

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

component = dmc.Stack([
    dmc.Title("dmc.Checkbox with custom icons"),
    dmc.Checkbox(
        label="Custom checked icon",
        checked=True,
        icon=DashIconify(icon="ion:bag-check-sharp"),
        size="lg",        
    ),
    dmc.Checkbox(
        label="Custom indeterminate icons",
        indeterminate=True,
        indeterminateIcon=DashIconify(icon="mdi:dots-circle",),
        size="lg",    
    ),
    dmc.Divider(variant="solid"),
    dmc.Checkbox(
        label="Standard checked icon",
        checked=True,        
        size="lg",
        p=0,
    ),
    dmc.Checkbox(
        label="Standard indeterminate icons",
        indeterminate=True,
        size="lg",    
    )
], p="lg")

app.layout = dmc.MantineProvider(
    component
)

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