Components/Surfaces/Popover
COMPONENT23.23

Popover

Non-modal floating surface on the native Popover API — any trigger plus panel, anchored with side/align/offset and viewport flipping.


INSTALL

1pnpm dlx @sayagodev/mo add popover

Or import the files from the package (no copy):

1import "@sayagodev/mo/css/popover.css";

EXAMPLES

Basic
Dimensions

Set the dimensions for the layer.

Grid form
Dimensions

Set the dimensions for the layer.

Alignments
Aligned to start
Aligned to center
Aligned to end
With form
Dimensions

Set the dimensions for the layer.

USAGE

1<button popovertarget="p1">Open popover</button>2 3<div popover id="p1" class="popover" data-side="bottom" data-align="center">4  <div data-title>Dimensions</div>5  <p data-description>Set the dimensions for the layer.</p>6</div>7 8<!-- placement: data-side="top|right|bottom|left" (default bottom),9     data-align="start|center|end" (default center), data-offset (default 4) -->

API

NAMEKINDDESCRIPTION
.popoverclassSurface: w-72, bg-popover, p-4, shadow-md, enter transition
popovertargetattributeDeclarative trigger; the popover anchors to its invoker automatically
data-sideattributebottom (default) · top · right · left; flips on viewport overflow
data-alignattributecenter (default) · start · end
data-offsetattributeGap from the trigger, default 4 (Radix sideOffset)
[data-title] / [data-description]attributeHeader anatomy
--mo-popover-width / --mo-popover-radiustokenWidth and radius hooks

FILES

src/css/popover.css
Install:mo add popover

THEMING · PLAYGROUND

This is the exact component from the examples above, wearing a completely different theme. Edit the tokens and --mo-* hooks in the editor — autocomplete knows them all — and the preview obeys in real time. Your CSS always wins.

Tokens & hooks — edit live
Global tokens
--foreground--muted-foreground--popover--popover-foreground--radius
Component hooks
--mo-popover-radius--mo-popover-width

Preview

Dimensions

Width and height of the sealed unit.

Your CSS

Try it: type --mo- for the component hooks, or edit any value — the preview obeys in real time.