variantjs/vue

Use other element instead of button for dropdown

Chappie74 opened this issue · 3 comments

Is it possible to use a custom element to trigger the dropdown?
I've tried multiple things, but it seems the top element is still using
Instead of a button, I want to use an icon. Or have customisation like the below image found in the old docs

image

Using that code snippet. This is how it currently shows up.

image

@Chappie74 the dropdown component have a tagName prop that you can use to define the tag that will wrap the trigger, if you want to change the content of the trigger you can use the trigger slot.

For example, let say that you want to use a div as the wrapper and add and span with an icon:

<t-dropdown tag-name="div">
<template #trigger>
<span class="wharver">Open me <SVG .... /></span>
</template>
<!-- content of the dropdown -->
</t-dropdown>

^ made that from memory but should work

Thank you for your answer works great!
How can i specify a variant for the generated button ?

Thanks. I ended up switching to daisy UI. Glad it helped someone else though.