Skip to content

Popover ​

Popover is a floating panel anchored to a trigger, built on reka-ui. Pass the trigger through the trigger slot and the panel content through the default slot; bind v-model:open to control it, or omit it to let the component manage its own state.

vue
<script setup lang="ts">
import { Button, Popover } from '@myghf/ui'
</script>

<template>
  <Popover>
    <template #trigger><Button>Filters</Button></template>
    <!-- panel content -->
  </Popover>
</template>
vue
<script setup lang="ts">
import { ref } from 'vue'
import { Button, Popover } from '@myghf/ui'

const open = ref(false)
</script>

<template>
  <Popover v-model:open="open">
    <template #trigger>
      <Button size="sm">Filters</Button>
    </template>
    <p class="text-sm text-muted">Configure the record filters here.</p>
  </Popover>
</template>

Props ​

PropTypeDefaultDescription
openboolean—Controlled open state. Omit for uncontrolled. Bind with v-model:open.
side'top' | 'right' | 'bottom' | 'left''bottom'Preferred side.
align'start' | 'center' | 'end''start'Alignment along the side.
sideOffsetnumber4Gap from the trigger, in pixels.

Events ​

EventPayloadDescription
update:openbooleanEmitted when the open state changes.

Slots ​

SlotDescription
triggerThe trigger element (one focusable node).
defaultThe panel content.

Accessibility ​

  • reka-ui gives the trigger aria-expanded/aria-controls and moves focus into the content; Esc closes it and returns focus to the trigger, and a pointer press outside closes it too.
  • Keep the trigger a real control (a Button or a link) so it is keyboard reachable.

Dark mode & RTL ​

  • The panel uses semantic tokens (bg-surface, border-border, shadow-popover), so it adapts to dark mode automatically. Positioning comes from reka's popper, which honours the document direction, so it mirrors correctly under dir="rtl".

Released under the MIT License.