Skip to content

Commit

Permalink
feat(#93): add tag prop to customise component tag (#144)
Browse files Browse the repository at this point in the history
* feat(#93): add tag prop to customise component tag

* chore(#93): add validator
  • Loading branch information
Decipher authored Mar 12, 2024
1 parent 8f05f78 commit 68adfa8
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/components/Popover.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<div
<component
:is="tag"
:class="`ct-popover ${themeClass}`"
data-collapsible="1"
data-collapsible-collapsed=""
Expand All @@ -18,16 +19,17 @@
</slot>
</a>

<div
<component
:is="tag"
class="ct-popover__content"
data-collapsible-panel
data-collapsible-trigger-no-icon
>
<div class="ct-popover__content__inner">
<component :is="tag" class="ct-popover__content__inner">
<slot />
</div>
</div>
</div>
</component>
</component>
</component>
</template>

<script>
Expand All @@ -37,6 +39,11 @@ export default {
mixins: [ThemeMixin],
props: {
tag: {
type: String,
validator: (value) => ['div', 'span'].includes(value),
default: 'div'
},
trigger: {
type: String,
default: 'Click me'
Expand Down

0 comments on commit 68adfa8

Please sign in to comment.