Custom Icon for ToggleButton?
-
- Posts: 3
- Joined: 04 Sep 2021, 09:13
Hi, I'd like to use a SVG image as the icon for a ToggleButton (as opposed to using PrimeIcons). Is there a way to customise it, similar to the templating in Button?
-
- Posts: 3
- Joined: 04 Sep 2021, 09:13
I ended up solving this issue by conditionally rendering Buttons.
So instead:
I am using:
There are minor UI differences using the approaches, such as border colours which require a bit of CSS touch-ups, but seem to work well for my case.
Note, initially I tried to use SelectButton - but there's an issue with tooltip, so didn't go with it (I'll post a separate question on this issue).
So instead:
Code: Select all
<ToggleButton ... />
<ToggleButton ... />
<ToggleButton ... /> <!-- this third button needs custom icons -->
Code: Select all
<Button ... />
<Button ... />
<Button ... > <!-- this third button needs custom icons -->
<img v-if="someCondition"src="../assets/logo-1.svg"... />
<img v-else src="../assets/logo-2.svg"... />
</Button>
Note, initially I tried to use SelectButton - but there's an issue with tooltip, so didn't go with it (I'll post a separate question on this issue).
-
- Posts: 560
- Joined: 23 Oct 2020, 09:28
Hi,
Tooltip doesn't have templating but as you said Button has. We would be grateful if you create a PR with the possible solution.
Regards,
Tooltip doesn't have templating but as you said Button has. We would be grateful if you create a PR with the possible solution.
Regards,
-
- Information
-
Who is online
Users browsing this forum: No registered users and 3 guests