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
Can I add an icon to a button #408
Comments
Hey @cverluiseQB, yes, there is! Generally, whenever you find yourself in a situation where you want to extend the functionality of an existing component, creating custom components is the answer 👍 I want to emphasize two additional changes, though:
Example
|
This is a great question @cverluiseQB, thanks for posting it here so we have it on the open source repo 👍 And great answer @huong-li-nguyen 💯 A couple of notes for future reference: this is something that dmc natively enables through dash-iconify and e.g. Another thing I've wondered before is whether we should just encourage users who want to do such things to relax the field types. e.g.
(completely untested, might not work, but hopefully you get the general idea) The advantage of this is that it has infinite flexibility since you could put whatever you like in The disadvantage is that the model becomes much less prescriptive. On the Vizro side it would be much cleaner to have a new |
Which package?
vizro
What's the problem this feature will solve?
As a developer, I would like to easily communicate the purpose of a button using standard icons.
Describe the solution you'd like
A simple option would be to add an
icon
field to thevm.Button
here a valid material icon name could be passed (similar to what is done for nav) so that the icon is natively rendered at the left of the text of the buttonAlternative Solutions
Document how this can be done with custom component (e.g. pointing at the code of the export data button).
Additional context
Nothing to add
Code of Conduct
The text was updated successfully, but these errors were encountered: