0.1.0-rc.2

Popover

Popovers anchor rich content to a trigger element (filters, mini forms, or contextual details) without modal focus trapping.

Try it

Usage

Wrap content in RuiPopoverTrigger and RuiPopoverContent. Control open, placement, and portal for positioning.

import { RuiPopover, RuiPopoverTrigger, RuiPopoverContent } from '@ecopages/radiant-ui/popover';
import { RuiButton } from '@ecopages/radiant-ui/button';
 
<RuiPopover placement="bottom-start">
  <RuiPopoverTrigger>
    <RuiButton variant="outline">Filter</RuiButton>
  </RuiPopoverTrigger>
  <RuiPopoverContent>
    <p>Show items from the last 7 days.</p>
  </RuiPopoverContent>
</RuiPopover>

Listbox variant

Set variant="listbox" when the popover hosts a RuiListbox; width and focus behavior adapt automatically.

Match anchor width

Enable matchAnchorWidth for select-style popovers so the panel aligns with the trigger.

Theming

The popover surface maps to semantic surface roles, never Tailwind palette steps:

PartCSS roles
Surface (rui-popover)background, on-background, border, rounded-container, shadow-overlay
Listbox variantStripped padding for embedded listboxes
Z-orderpopover (below dialogs, above page content)

Overrides go at the theme layer, not in component CSS.

Accessibility

  • Triggers expose aria-expanded when the popover is open.
  • Content is focusable and dismissible with Escape.
  • Do not trap focus; users should reach surrounding content without closing first.

API

RuiPopover is a custom element (<rui-popover>) positioning a floating role="dialog" surface. RuiPopoverTrigger (<rui-popover-trigger>) coordinates open state with the trigger click.

Attributes (<rui-popover>)

AttributeTypeDefaultDescription
openbooleanfalseWhether the popover is open (controlled).
placementRuiPlacementbottomPlacement relative to the anchor.
portalbooleantrueTeleport the surface to document.body.
match-anchor-widthbooleanfalseMatch the anchor width (dropdown menus).
offsetnumber8Gap between anchor and surface in px.
anchorstring''CSS selector for an external anchor.
variantdefault · listboxdefaultSurface variant; listbox strips padding.

Attributes (<rui-popover-trigger>)

AttributeTypeDefaultDescription
openbooleanfalseWhether the popover starts open.

Slots

ComponentSlotDescription
RuiPopovertriggerPressable anchor (when not using an external anchor).
RuiPopovercontentPopover body rendered inside the floating surface.
RuiPopoverTriggertriggerPressable element that toggles the child popover.
RuiPopoverTrigger(default)The child <rui-popover>.

Events

EventDetailDescription
rui-open-change{ open: boolean }Emitted when open state changes.

CSS classes

Public BEM classes (documented via @cssclass):

ClassDescription
.rui-popover-hostAnchor + surface wrapper.
.rui-popoverFloating surface (role="dialog"); background + rounded-container + shadow-overlay.
.rui-popover--listboxStripped padding for embedded listboxes.
.rui-popover-triggerTrigger + popover wrapper.

Theme roles

PartCSS variables consumed
Surface--background, --on-background, --border, --radius-container, --shadow-overlay
Z-order--z-popover