Skip to content
Focsd homeFocsd homeFocsd
Forms

Popover

A non-modal panel attached to a trigger, for filters and small forms.

  • Tag: focsd-popover
  • Pattern: Non-modal dialog (popover API)
  • Category: Overlays

Example

Filters Active only Apply
HTML
<focsd-popover label="Filter members" closable>
<focsd-button slot="trigger">Filters</focsd-button>
<focsd-checkbox name="active">Active only</focsd-checkbox>
<focsd-button variant="action">Apply</focsd-button>
</focsd-popover>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/components/focsd-popover.js';
</script>
<focsd-popover label="Filter members" closable>…</focsd-popover>

API

Attributes

AttributePropertyTypeDefault
labellabelstring—
openopenbooleanfalse
placementplacement'top' | 'bottom'bottom
closableclosablebooleanfalse

Methods

MethodDescription
show()Open the popover and move focus into it.
hide()Close the popover.

Slots

SlotDescription
(default)Default content.
triggerThe button that opens the popover.

CSS parts

Style the inside of the component with ::part(), for example focsd-popover::part(close).

PartDescription
closeThe close (×) button, with `closable`; focus returns to the trigger.
panelThe panel element.

Accessibility

  • The panel is a non-modal role="dialog" named by label; the trigger gets aria-expanded and aria-haspopup="dialog".
  • Focus moves to the first focusable element in the panel and returns to the trigger on Escape or outside click.
  • closable adds a close (×) button named "Close" to the panel, useful on touch screens and for panels with a form. It returns focus to the trigger.
  • Positioned with CSS anchor positioning in the top layer (popover API).

Keyboard

KeyAction
Enter / Space (trigger)Open or close
EscapeClose and return focus to the trigger