How to make ui.switch / ui.button use a custom icon with currentColor? #5523
Unanswered
painter-bk
asked this question in
Q&A
Replies: 2 comments 1 reply
-
|
Hi @painter-bk, Why do you think a custom component would work? I can't find anything about it the Quasar documentation. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Example Code
testvueicon.py
TestIcon.py
static/test-icon.vue
static/test-icon.svg - for comparison only
Description
I am trying to use a custom icon in a ui.switch that changes its color by using currentColor. AFAIK this is expected not to work with an svg file as an image, instead it requires a vue component. For this I created the test-icon.vue component, and tried to register it following the custom_vue_component example. The program renders the icon incorrectly (or not at all, or something different). For comparison, the last button shows the correct icon as img/svg.
Neither the program nor the browser shows any errors. The source in the browser for the icon in the first button looks like this:
<i class="q-icon on-left notranslate material-icons" aria-hidden="true" role="img">test-icon</i>It seems still to refer to some "material-icons".
So, what am I doing wrong? Wrong approach? Wrong registration? File name or Icon naming convention issues? Any help appreciated.
NiceGUI Version
2.24.1
Python Version
Python 3.12.10
Browser
Other
Operating System
Windows
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions