Popovers
Small panels next to their button with links, buttons and fields: placement, rich content, confirmation and a field.
Basic and placement
A popover is a small panel opened by a click, next to its button. Unlike a tooltip it can hold links, buttons and fields, so it opens on click (never on hover) and it is not modal: the button has aria-haspopup="true" and aria-controls, the popup script keeps aria-expanded, moves the focus into the panel and closes it with Esc or a click outside, returning the focus to the button. Four placements: top, bottom, left, right. button-text or button-icon renders the button, and button-class adds classes to it. The id is on the root, the button is <id>-button and the panel <id>-panel.
<div id="pop-top" class="relative inline-block">
<button
id="pop-top-button"
type="button"
aria-controls="pop-top-panel"
aria-expanded="false"
aria-haspopup="true"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Top</span>
</button>
<div
id="pop-top-panel"
class="bottom-full left-1/2 mb-2 -translate-x-1/2 invisible absolute z-10 w-64 rounded-xl bg-white p-4 text-left opacity-0 shadow-lg ring-1 ring-dominant-300 transition-opacity duration-150 motion-reduce:transition-none [[aria-expanded=true]~&]:visible [[aria-expanded=true]~&]:opacity-100 [:has([aria-expanded=true])~&]:visible [:has([aria-expanded=true])~&]:opacity-100 dark:bg-dominant-900 dark:ring-dominant-600"
role="dialog"
aria-labelledby="pop-top-title"
>
<h3 id="pop-top-title" class="text-sm font-semibold text-dominant-900 dark:text-white">
Popover on top
</h3>
<div class="mt-2 text-sm text-dominant-700 dark:text-dominant-200">
A short piece of content next to the control that opened it.
</div>
</div>
</div>
<div id="pop-bottom" class="relative inline-block">
<button
id="pop-bottom-button"
type="button"
aria-controls="pop-bottom-panel"
aria-expanded="false"
aria-haspopup="true"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Bottom</span>
</button>
<div
id="pop-bottom-panel"
class="top-full left-1/2 mt-2 -translate-x-1/2 invisible absolute z-10 w-64 rounded-xl bg-white p-4 text-left opacity-0 shadow-lg ring-1 ring-dominant-300 transition-opacity duration-150 motion-reduce:transition-none [[aria-expanded=true]~&]:visible [[aria-expanded=true]~&]:opacity-100 [:has([aria-expanded=true])~&]:visible [:has([aria-expanded=true])~&]:opacity-100 dark:bg-dominant-900 dark:ring-dominant-600"
role="dialog"
aria-labelledby="pop-bottom-title"
>
<h3 id="pop-bottom-title" class="text-sm font-semibold text-dominant-900 dark:text-white">
Popover on bottom
</h3>
<div class="mt-2 text-sm text-dominant-700 dark:text-dominant-200">
A short piece of content next to the control that opened it.
</div>
</div>
</div>
<div id="pop-left" class="relative inline-block">
<button
id="pop-left-button"
type="button"
aria-controls="pop-left-panel"
aria-expanded="false"
aria-haspopup="true"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Left</span>
</button>
<div
id="pop-left-panel"
class="max-sm:bottom-full max-sm:left-1/2 max-sm:mb-2 max-sm:-translate-x-1/2 sm:right-full sm:top-1/2 sm:mr-2 sm:-translate-y-1/2 invisible absolute z-10 w-64 rounded-xl bg-white p-4 text-left opacity-0 shadow-lg ring-1 ring-dominant-300 transition-opacity duration-150 motion-reduce:transition-none [[aria-expanded=true]~&]:visible [[aria-expanded=true]~&]:opacity-100 [:has([aria-expanded=true])~&]:visible [:has([aria-expanded=true])~&]:opacity-100 dark:bg-dominant-900 dark:ring-dominant-600"
role="dialog"
aria-labelledby="pop-left-title"
>
<h3 id="pop-left-title" class="text-sm font-semibold text-dominant-900 dark:text-white">
Popover on left
</h3>
<div class="mt-2 text-sm text-dominant-700 dark:text-dominant-200">
A short piece of content next to the control that opened it.
</div>
</div>
</div>
<div id="pop-right" class="relative inline-block">
<button
id="pop-right-button"
type="button"
aria-controls="pop-right-panel"
aria-expanded="false"
aria-haspopup="true"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Right</span>
</button>
<div
id="pop-right-panel"
class="max-sm:bottom-full max-sm:left-1/2 max-sm:mb-2 max-sm:-translate-x-1/2 sm:left-full sm:top-1/2 sm:ml-2 sm:-translate-y-1/2 invisible absolute z-10 w-64 rounded-xl bg-white p-4 text-left opacity-0 shadow-lg ring-1 ring-dominant-300 transition-opacity duration-150 motion-reduce:transition-none [[aria-expanded=true]~&]:visible [[aria-expanded=true]~&]:opacity-100 [:has([aria-expanded=true])~&]:visible [:has([aria-expanded=true])~&]:opacity-100 dark:bg-dominant-900 dark:ring-dominant-600"
role="dialog"
aria-labelledby="pop-right-title"
>
<h3 id="pop-right-title" class="text-sm font-semibold text-dominant-900 dark:text-white">
Popover on right
</h3>
<div class="mt-2 text-sm text-dominant-700 dark:text-dominant-200">
A short piece of content next to the control that opened it.
</div>
</div>
</div>
Rich content
Use a popover for a small summary or a quick question. The profile shows more about a name without leaving the page; the confirmation asks before a risky action, and its buttons are closers (they share the aria-controls of the trigger). For a decision with serious consequences use a modal.
<div id="pop-profile" class="relative inline-block">
<button
id="pop-profile-button"
type="button"
aria-controls="pop-profile-panel"
aria-expanded="false"
aria-haspopup="true"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span id="avatar-1627-wrapper" class="relative inline-flex shrink-0">
<span
id="avatar-1627"
class="inline-flex shrink-0 items-center justify-center size-7 rounded-full font-semibold text-xs bg-primary-100 dark:bg-primary-900/50 text-primary-800 dark:text-primary-300"
aria-hidden="true"
>AM</span
>
</span>
<span>Alex Morgan</span>
</button>
<div
id="pop-profile-panel"
class="top-full left-1/2 mt-2 -translate-x-1/2 invisible absolute z-10 w-72 rounded-xl bg-white p-4 text-left opacity-0 shadow-lg ring-1 ring-dominant-300 transition-opacity duration-150 motion-reduce:transition-none [[aria-expanded=true]~&]:visible [[aria-expanded=true]~&]:opacity-100 [:has([aria-expanded=true])~&]:visible [:has([aria-expanded=true])~&]:opacity-100 dark:bg-dominant-900 dark:ring-dominant-600"
role="dialog"
aria-labelledby="pop-profile-title"
>
<h3 id="pop-profile-title" class="text-sm font-semibold text-dominant-900 dark:text-white">
Profile summary
</h3>
<div class="mt-2 text-sm text-dominant-700 dark:text-dominant-200">
<div class="flex items-center gap-3">
<span id="avatar-1719-wrapper" class="relative inline-flex shrink-0">
<span
id="avatar-1719"
class="inline-flex shrink-0 items-center justify-center size-10 rounded-full font-semibold text-sm bg-primary-100 dark:bg-primary-900/50 text-primary-800 dark:text-primary-300"
aria-hidden="true"
>AM</span
>
</span>
<div>
<p class="text-sm font-semibold text-dominant-900 dark:text-white">Alex Morgan</p>
<p class="text-xs text-dominant-700 dark:text-dominant-200">Product manager</p>
</div>
</div>
<p class="mt-3 text-sm text-dominant-700 dark:text-dominant-200">
Leads the catalogue team. 24 products published this month.
</p>
<div class="mt-3">
<a
id="link-1781"
href="#"
class="font-semibold rounded underline-offset-2 focus-visible:ring-2 focus-visible:outline-none text-primary-700 dark:text-primary-300 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 hover:underline focus-visible:underline hover:text-primary-800 dark:hover:text-primary-200"
>
<span>View profile</span>
</a>
</div>
</div>
</div>
</div>
<div id="pop-confirm" class="relative inline-block">
<button
id="pop-confirm-button"
type="button"
aria-controls="pop-confirm-panel"
aria-expanded="false"
aria-haspopup="true"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<i aria-hidden="true" class="fa-solid fa-trash"></i><span>Delete</span>
</button>
<div
id="pop-confirm-panel"
class="bottom-full left-1/2 mb-2 -translate-x-1/2 invisible absolute z-10 w-64 rounded-xl bg-white p-4 text-left opacity-0 shadow-lg ring-1 ring-dominant-300 transition-opacity duration-150 motion-reduce:transition-none [[aria-expanded=true]~&]:visible [[aria-expanded=true]~&]:opacity-100 [:has([aria-expanded=true])~&]:visible [:has([aria-expanded=true])~&]:opacity-100 dark:bg-dominant-900 dark:ring-dominant-600"
role="dialog"
aria-labelledby="pop-confirm-title"
>
<h3 id="pop-confirm-title" class="text-sm font-semibold text-dominant-900 dark:text-white">
Delete this product?
</h3>
<div class="mt-2 text-sm text-dominant-700 dark:text-dominant-200">
<p class="text-sm text-dominant-700 dark:text-dominant-200">
The product and its photos will be removed. This cannot be undone.
</p>
<div class="flex justify-end gap-2 mt-4">
<button
id="button-1877"
type="button"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-1.5 px-3 py-1.5 text-sm"
>
<span>Cancel</span>
</button>
<button
id="button-1893"
type="button"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 bg-danger-600 text-white shadow-sm not-disabled:hover:bg-danger-700 not-disabled:active:bg-danger-800 focus-visible:ring-danger-700 dark:focus-visible:ring-danger-400 gap-1.5 px-3 py-1.5 text-sm"
>
<span>Delete</span>
</button>
</div>
</div>
</div>
</div>
With a field
A field inside a popover needs a visible label like any other field. The popup script puts the focus on the first control when the popover opens, so keep the most useful control first. Tab stays free to leave the popover, which then stays open until Esc or a click outside.
<div id="pop-share" class="relative inline-block">
<button
id="pop-share-button"
type="button"
aria-controls="pop-share-panel"
aria-expanded="false"
aria-haspopup="true"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 bg-primary-100 dark:bg-primary-900/50 text-primary-800 dark:text-primary-300 not-disabled:hover:bg-primary-200 dark:not-disabled:hover:bg-primary-900 not-disabled:active:bg-primary-300 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<i aria-hidden="true" class="fa-solid fa-share-nodes"></i><span>Share</span>
</button>
<div
id="pop-share-panel"
class="top-full left-1/2 mt-2 -translate-x-1/2 invisible absolute z-10 w-72 rounded-xl bg-white p-4 text-left opacity-0 shadow-lg ring-1 ring-dominant-300 transition-opacity duration-150 motion-reduce:transition-none [[aria-expanded=true]~&]:visible [[aria-expanded=true]~&]:opacity-100 [:has([aria-expanded=true])~&]:visible [:has([aria-expanded=true])~&]:opacity-100 dark:bg-dominant-900 dark:ring-dominant-600"
role="dialog"
aria-labelledby="pop-share-title"
>
<h3 id="pop-share-title" class="text-sm font-semibold text-dominant-900 dark:text-white">
Share this product
</h3>
<div class="mt-2 text-sm text-dominant-700 dark:text-dominant-200">
<div id="pop-share-link-field" class="group/field">
<label
for="pop-share-link"
class="block mb-1.5 text-sm font-medium text-dominant-700 dark:text-dominant-200 group-has-[:is(input,select,textarea):disabled]/field:opacity-50 group-has-[:is(input,select,textarea):required]/field:after:content-['*'] after:ml-0.5 after:text-danger-700 dark:after:text-danger-300"
>Link</label
>
<input
id="pop-share-link"
type="text"
class="block w-full rounded-lg bg-white dark:bg-dominant-950 text-dominant-900 dark:text-white inset-ring inset-ring-dominant-500 dark:inset-ring-dominant-400 placeholder:text-dominant-600 dark:placeholder:text-dominant-400 focus:inset-ring-primary-500 dark:focus:inset-ring-primary-400 focus:ring-2 focus:ring-primary-500/30 dark:focus:ring-primary-400/30 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:inset-ring-danger-600 dark:aria-invalid:inset-ring-danger-400 aria-invalid:focus:inset-ring-danger-600 dark:aria-invalid:focus:inset-ring-danger-400 aria-invalid:focus:ring-danger-600/30 dark:aria-invalid:focus:ring-danger-400/30 px-3.5 py-2.5 text-sm read-only:bg-dominant-100 dark:read-only:bg-dominant-800"
readonly
value="https://example.com/products/42"
/>
</div>
<div class="flex justify-end mt-3">
<button
id="button-1772"
type="button"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 bg-primary-600 text-white shadow-sm not-disabled:hover:bg-primary-700 not-disabled:active:bg-primary-800 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-1.5 px-3 py-1.5 text-sm"
>
<span>Done</span>
</button>
</div>
</div>
</div>
</div>
Options reference
No script of its own: the popup script of the page handles the popup.
| Part | Value | Description |
|---|---|---|
| Trigger |
aria-haspopup="true", aria-controls, aria-expanded
|
A button. The popup script toggles aria-expanded.
|
| Panel |
<id>-panel, role="dialog", aria-labelledby
|
Not modal: the rest of the page stays reachable. Hidden with invisible until the trigger is expanded.
|
| Wrapper |
relative
|
Anchors the panel. The panel shows while the button before it is expanded. |
| Placement | top, bottom, left, right | Position classes of the panel. Keep it inside the screen; a wide popover belongs at the bottom on a phone. |
| Closer |
button with the same aria-controls
|
Inside the panel: Cancel, Done. |
| Keys | Enter or Space, Esc | Open from the button; Esc closes and returns to the button. |
| Tooltip or popover? | hover/focus label vs click panel | A tooltip only names or explains; if the person must read, click or type, use a popover. |