mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
feat(Popover): add anchor slot (#4119)
Co-authored-by: Jakub <jakub.michalek@freelo.io> Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -43,6 +43,7 @@ export interface PopoverEmits extends PopoverRootEmits {
|
||||
export interface PopoverSlots {
|
||||
default(props: { open: boolean }): any
|
||||
content(props?: {}): any
|
||||
anchor(props?: {}): any
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -103,6 +104,10 @@ const Component = computed(() => props.mode === 'hover' ? HoverCard : Popover)
|
||||
<slot :open="open" />
|
||||
</Component.Trigger>
|
||||
|
||||
<Component.Anchor v-if="'Anchor' in Component && !!slots.anchor" as-child>
|
||||
<slot name="anchor" />
|
||||
</Component.Anchor>
|
||||
|
||||
<Component.Portal v-bind="portalProps">
|
||||
<Component.Content v-bind="contentProps" :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })" v-on="contentEvents">
|
||||
<slot name="content" />
|
||||
|
||||
Reference in New Issue
Block a user