Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Allow functions as props. #356

Open
paulremo opened this issue Oct 15, 2024 · 1 comment
Open

[Feature Request] Allow functions as props. #356

paulremo opened this issue Oct 15, 2024 · 1 comment

Comments

@paulremo
Copy link

paulremo commented Oct 15, 2024

First of - thanks for this awesome library! It's a lot of fun to work with and it really improves the look of the Dash Apps it is used with 😃.

I have a feature request to add support for label formatting on slider elements, e.g., 40 °C for values of 40.

Background

This is supported in Mantine (see https://mantine.dev/core/slider/#control-label) and would be great to have in dmc. The docs hint at this being implemented already with the label argument (Function to generate label or any react node to render instead, set to None to disable label.), but I couldn't get it to work or find an example that explains this.

What I've tried

I guess from Python the most straight-forward way to implement this would be to support passing functions to the label argument of the Slider constructor. Currently, passing label=lambda x: x raises an Error loading layout error.

Thanks!

@AnnMarieW
Copy link
Collaborator

AnnMarieW commented Oct 15, 2024

Hi @paulremo

Unfortunately, there is no easy solution or workaround for this one.

By default, Dash does not allow for passing functions as props. I would love to implement a solution similar to how it's done with Dash AG Grid

I'll update the feature request to a broader request: Allow functions as props. This feature would be a great addition to dash-mantine-components, as many of Mantine's components accept functions as props

@AnnMarieW AnnMarieW changed the title [Feature Request] Slider support for label formatting. [Feature Request] Allow functions as props. Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants