Popover ​
A rich floating element displayed on user interaction (click, hover, manual)
<script setup lang="ts">
import { HButton, HIcon, HPopover } from '@holistics/design-system'
</script>
<template>
<HPopover>
<div class="flex items-center">
<HIcon name="canvas" />
<span class="ml-1">Canvas Dashboard</span>
</div>
<template #content>
<div>
<div class="text-title-xs text-gray-900">
Owner
</div>
<div class="text-gray-700">
[email protected]
</div>
</div>
<div class="mt-2">
<div class="text-title-xs text-gray-900">
Description
</div>
<div class="text-gray-700">
Te affert vivendo pro. Quas constituto id his, intellegam consectetuer vituperatoribus no eam.
Ne his dictas epicuri eloquentiam, sea lorem petentium te. Usu nulla partem explicari et, labore assueverit per ei.
</div>
</div>
<div class="mt-2 flex justify-end">
<HButton
type="secondary-default"
size="sm"
icon="edit"
>
Edit
</HButton>
</div>
</template>
</HPopover>
</template>API ​
Pass-through: <HPopper> ​
What does this mean?
All props, events, and attrs that are not specified in the tables below will be passed to the element/component described above.
Props ​
| Name | Type | Description |
|---|---|---|
disabled | boolean | When |
anchor | PopperAnchorRect | PopperAnchorElement | Anchor element. Can be an object with coordinates or a virtual element. {@link https://floating-ui.com/docs/virtual-elements} |
safeAreaDuration | number | Duration (ms) of the safe area to exist before closing. |
disableOutsidePointerEvents | boolean | When To interact with any element within lower layers, user will need to click outside of all layers with
This can be used as a way to force all lower layers to not emit |
strategy | Strategy | The type of CSS {@link https://floating-ui.com/docs/computeposition#strategy} |
disableTransform | boolean | By default, the Floating element is positioned using {@link https://floating-ui.com/docs/vue#disabling-transform} |
placement | Placement | The placement of the Floating element relative to the Anchor element. {@link https://floating-ui.com/docs/computeposition#placement} |
distance | number= 2 | The distance between the Floating element and the Anchor element (applied on the axis that runs along the side of the Floating element). {@link https://floating-ui.com/docs/offset#mainaxis} |
skidding | number | The skidding between the Floating element and the Anchor element (applied on the axis that runs along the alignment of the Floating element). {@link https://floating-ui.com/docs/offset#crossaxis} |
allowCollisions | boolean | Whether to allow the Floating element to collide with the boundary. |
collisionBoundary | Boundary | The clipping element(s) or area that collision will be checked relative to. {@link https://floating-ui.com/docs/detectOverflow#boundary} |
collisionPadding | Padding | The virtual padding around the boundary to check for collision. {@link https://floating-ui.com/docs/detectOverflow#padding} |
noShift | boolean | When {@link https://floating-ui.com/docs/shift} |
noFlip | boolean | When {@link https://floating-ui.com/docs/flip} |
prioritizePlacement | boolean | Whether to prioritize shifting (i.e. keeping original {@link https://floating-ui.com/docs/flip#combining-with-shift} |
arrow | boolean= true | Whether to render arrow elements. The arrow has 2 parts: outer and inner. The inner will always overlap the outer to be able to create a continuous border connecting the arrow with the Floating element. |
arrowPadding | Padding | The padding between the arrow and the edges of the Floating element. {@link https://floating-ui.com/docs/arrow#padding} |
autoAvailableSize | boolean | Whether to automatically set |
matchAnchorSize | boolean | "min" | "max" | Config to match the Anchor "size". The "size" here is detected by the final side of the Floating element:
|
transformOrigin | boolean | Whether to add CSS |
hideWhenDetached | boolean | Whether to hide the Floating element when the Anchor element becomes fully occluded. |
updatePositionStrategy | "optimized" | "always" | "none" | Strategy to update the position of the Floating element when necessary ( {@link https://floating-ui.com/docs/autoupdate} |
trapFocus | boolean | Whether to trap focus so it cannot escape the Floating element via keyboard, pointer, or a programmatic focus. |
autoFocus | boolean | Whether to automatically focus first focusable element inside the Floating element on mount. |
autoFocusElement | string | true | FocusableElement | null | Custom element used to automatically focus on mount or when calling the exposed
|
floatingProps | HTMLAttributes | Additional props bound to the Floating element. |
contentClass | HTMLAttributeClass | HTML |
contentStyle | StyleValue | HTML |
contentProps | HTMLAttributes | Additional props bound to the Content element. |
open | boolean | The opening state of the Floating element. |
delay | number | null | The delay duration (in milliseconds) from when hovering the Anchor element until the NOTE:
|
disableHoverableContent | boolean | When |
forceHoverProviderSafeAreas | boolean | By default, |
floatingTeleportTo | string | RendererElement | null | Specify target container. Can either be a selector or an actual element. {@link https://vuejs.org/api/built-in-components.html#teleport} |
floatingTeleportDisabled | boolean | When {@link https://vuejs.org/api/built-in-components.html#teleport} |
floatingTeleportDefer | boolean | When {@link https://vuejs.org/api/built-in-components.html#teleport} |
floatingClass | HTMLAttributeClass | HTML |
floatingStyle | StyleValue | HTML |
contentAsChild | boolean |
|
trigger | PopperTrigger= "click" | The type of event to automatically control opening state of the Floating element. |
floatingPadding | "default" | "thick"= "default" | Padding preference of the Floating element:
|
Events ​
| Name | Parameters | Description |
|---|---|---|
@update:open | [opened: boolean] | |
@postOpen | [event: CustomEvent<any>] | |
@postClose | [event: CustomEvent<any>] | |
@pointerDownOutside | [event: PointerDownOutsideEvent] | |
@focusOutside | [event: FocusOutsideEvent] | |
@interactOutside | [event: PointerDownOutsideEvent | FocusOutsideEvent] | |
@keydownEscape | [event: KeyboardEvent] | |
@autoFocusOnMount | [event: CustomEvent<any>] | |
@autoFocusOnUnmount | [event: CustomEvent<any>] |
Slots ​
| Name | Scoped | Description |
|---|---|---|
#default | { open: boolean; onOpen: () => void; onClose: (force?: boolean | undefined, propagated?: boolean | undefined) => void; updatePosition: EventHookTrigger<void>; } | |
#content | { onClose: (force?: boolean | undefined, propagated?: boolean | undefined) => void; updatePosition: EventHookTrigger<void>; } |
Exposed ​
| Name | Type | Description |
|---|---|---|
popperRef | ({ $: ComponentInternalInstance; $data: {}; $props: { readonly open?: boolean | undefined; readonly trigger: PopperTrigger; readonly delay?: number | null | undefined; ... 45 more ...; readonly onAutoFocusOnUnmount?: ((event: CustomEvent<...>) => any) | undefined; } & VNodeProps & AllowedComponentProps & ComponentCu... |