-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
fix closeButtonProps and clearButtonProps #493
Conversation
Test Environment for snehilvj/dash-mantine-components-493 |
Here's a minimal example for the modal: import dash_mantine_components as dmc
from dash import Dash, _dash_renderer, html, Output, Input, State, callback
from dash_iconify import DashIconify
_dash_renderer._set_react_version("18.2.0")
app = Dash(__name__)
component = html.Div(
[
dmc.Button("Open Modal", id="modal-demo-button"),
dmc.Modal(
title="New Modal",
id="modal-simple",
closeButtonProps={
"children": html.Div(" close", id="my-component"),
"icon": DashIconify(icon="radix-icons:cross-circled", color="red"),
"style": {"width": 60},
},
children=[
dmc.Text("I am in a modal component."),
],
),
]
)
app.layout = dmc.MantineProvider(component)
@callback(
Output("modal-simple", "opened"),
Input("modal-demo-button", "n_clicks"),
State("modal-simple", "opened"),
prevent_initial_call=True,
)
def modal_demo(nc1, opened):
return not opened
if __name__ == "__main__":
app.run_server(debug=True)
Here's an example showing that you can set an import dash_mantine_components as dmc
from dash_iconify import DashIconify
from dash import Dash, _dash_renderer
_dash_renderer._set_react_version("18.2.0")
app = Dash(external_stylesheets=dmc.styles.ALL)
component = dmc.DatePickerInput(
label="Date clearable",
value="2025-01-01",
w=300,
clearable=True,
clearButtonProps={
"children" : dmc.Text("C"),
"icon": DashIconify(icon="radix-icons:cross-circled", color="red", width=30),
"size": 24
}
)
app.layout = dmc.MantineProvider(
component
)
if __name__ == "__main__":
app.run(debug=True) |
src/ts/props/button.ts
Outdated
iconSize?: number | string; | ||
/** Content rendered inside the button, for example `VisuallyHidden` with label for screen readers */ | ||
children?: React.ReactNode; | ||
/** Replaces default close icon. If set, `iconSize` prop is ignored. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clear buttons still have a default "close" icon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm kinda guessing on the clear button props because they aren't listed in their docs
https://mantine.dev/core/input/#inputclearbutton-component
https://mantine.dev/core/input/?t=props
Looking at their source code, it looks like they are taking the CloseButton and just updating it for the calculated size:
https://github.com/mantinedev/mantine/blob/master/packages/%40mantine/core/src/components/Input/InputClearButton/InputClearButton.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃
closes #492
closeButtonProps
clearButtonProps
sample app on PyCafe