snehilvj / dash-mantine-components

Plotly Dash components based on Mantine React Components
https://www.dash-mantine-components.com
MIT License
489 stars 43 forks source link

Grouped Select not showing items. #269

Open akunihiro opened 1 month ago

akunihiro commented 1 month ago

I am trying to create a dmc.Select element with grouping, but only the group labels are showing, not the sub-items.

import dash_mantine_components as dmc
from dash import Output, Input, html, callback

app = Dash(__name__)

content = html.Div(
    [
        dmc.Select(
            id="framework-select",
            data=[
                {
                    "group": "Frontend",
                    "items": [
                        {"value": "React", "label": "React"},
                        {"value": "Angular", "label": "Angular"},
                    ],
                },
                {
                    "group": "Backend",
                    "items": [
                        {"value": "Svelte", "label": "Svelte"},
                        {"value": "Vue", "label": "Vue"},
                    ],
                },
            ],
            w=200,
        ),
        dmc.Text(id="selected-value"),
    ]
)

@callback(Output("selected-value", "children"), Input("framework-select", "value"))
def select_value(value):
    return value

app.layout = dmc.MantineProvider(content)

if __name__ == "__main__":
    app.run_server(port=8885, jupyter_mode="external", debug=True)

Results in: image

dgtester commented 1 month ago

I also saw this on version 0.12.1 but upgrading to 0.14.3 fixed it

akunihiro commented 4 weeks ago

Thank you @dgtester, I was on 0.12.1, but unfortunately 0.14.3 introduced more errors (related to changes outlined here). I guess I will wait for better documentation for 0.14.3+ and time on my part to address those.