Popover
Connect an authored trigger to a native popover. Custom element
<ui-popover> <button class="ui-button" data-ui-part="trigger" type="button" popovertarget="release-popover" aria-controls="release-popover" aria-expanded="false" aria-haspopup="dialog">Release status</button> <div id="release-popover" popover="auto" role="dialog" aria-labelledby="release-popover-title" aria-describedby="release-popover-description"> <h2 id="release-popover-title">Ready to publish</h2> <p id="release-popover-description">All required package checks passed.</p> </div></ui-popover>Install
import '@timelessui/components/css/tokens.css'import '@timelessui/components/css/button.css'import '@timelessui/components/css/popover.css'import '@timelessui/components/define/ui-popover'Anatomy
Parts are authored in your own markup and identified by the selector below, so your CSS can target the same anatomy without loading Timeless styles. Required parts must be present for the component to work. Private data-ui-internal-* hooks are written by the runtime and must never be authored.
| Part | Required | Selector | Purpose |
|---|---|---|---|
trigger | Yes | [data-ui-part~='trigger'] | Native button that opens the surface. |
content | Yes | [popover] | The surface. Author the popover attribute so it stays hidden before enhancement. |
Attributes
Every value below is implemented by the stylesheets this component ships. Boolean attributes are presence-based: author the attribute with no value, or omit it.
| Attribute | Values | Default | Description |
|---|---|---|---|
placement | bottom · top · right · left | bottom | Preferred side of the trigger. Positioning uses CSS anchor positioning, so the browser may flip the surface to keep it on screen. |
role | dialog · menu · listbox · tooltip | dialog | Semantics applied to the surface, and the aria-haspopup value set on the trigger. Choose it from the interaction, not the appearance. |
Element API
Attributes above are the authoring surface. These are the DOM properties and events the registered element adds once it upgrades.
<ui-popover>
| Property | Type | Notes |
|---|---|---|
placement | 'bottom' | 'top' | 'right' | 'left' | Reflects the placement attribute, documented above. |
roleValue | 'dialog' | 'menu' | 'listbox' | 'tooltip' | Reflects the role attribute, documented above. |
This element dispatches no component events.
Styling
Root identity: ui-popover. Required stylesheets: tokens.css, button.css, popover.css.
This component adds no custom properties of its own. Restyle it through the design tokens or your own CSS.
Design tokens this component reads (29)
These are global Atmosphere tokens. Change them once at the theme level rather than per component.
--ui-accent · --ui-bg-accent · --ui-bg-accent-active · --ui-bg-accent-hover · --ui-bg-control · --ui-bg-control-active · --ui-bg-control-hover · --ui-bg-control-muted · --ui-bg-danger · --ui-bg-danger-active · --ui-bg-danger-hover · --ui-bg-surface · --ui-duration-fast · --ui-ease-standard · --ui-fg · --ui-fg-muted · --ui-focus · --ui-line · --ui-radius-control · --ui-radius-lg · --ui-radius-md · --ui-shadow-control-accent · --ui-shadow-control-active · --ui-shadow-control-danger · --ui-shadow-floating · --ui-shadow-outline-control · --ui-space-2 · --ui-space-3 · --ui-space-4
Accessibility
Keep the native elements, roles, and relationships shown in the example. Timeless adds only the state and keyboard coordination the platform does not already provide, and it never supplies your accessible names — those depend on your content.
Follows the Disclosure pattern from the ARIA Authoring Practices Guide.
| Key | Action |
|---|---|
| Escape | Close the surface. Handled by the Popover API, not by Timeless. |
Light dismiss, Escape, and top-layer stacking come from the Popover API. Timeless wires popovertarget, aria-controls, aria-expanded, and aria-haspopup, and gives the surface the role you asked for. Name the surface yourself when it is a dialog.
Before JavaScript runs
The markup above is complete and usable on its own: native controls submit, labels associate, and authored ARIA is already correct. Registration adds state synchronisation, focus management, and keyboard coordination on top of it.
More examples
Open Popover in StoryLite for variants, controls, and manual testing.