Place popup content, control dismissal, and choose when it stays mounted.

Popovers, menus, selects, and dialogs use the browser's top layer. They render in place, above the page, so you don't need a portal or Positioner part. Their events bubble through the elements around them like any other child's, so a click handler or a link wrapped around a popup also gets the clicks inside it. Keep popups outside clickable cards and links.

Place the Content

Set placement on the content part. With the * form, other attributes stay on the element, so pass the content's inputs as one object:

import { Component } from "@angular/core"
import {
  Popover,
  PopoverClose,
  PopoverContent,
  PopoverTitle,
  PopoverTrigger,
} from "@ui-sdk/angular/popover"

@Component({
  selector: "app-project-details",
  imports: [
    Popover,
    PopoverClose,
    PopoverContent,
    PopoverTitle,
    PopoverTrigger,
  ],
  template: `
    <ng-container uiPopover>
      <button uiPopoverTrigger>Details</button>
      <div
        *uiPopoverContent="{ side: 'bottom', align: 'start', sideOffset: 8 }"
      >
        <h2 uiPopoverTitle>Project Details</h2>
        <p>Last updated today.</p>
        <button uiPopoverClose>Done</button>
      </div>
    </ng-container>
  `,
})
export class ProjectDetails {}

The popup flips or shifts when there isn't enough room.

InputWhat It Does
sideChooses top, bottom, left, right, start, or end. Start and end follow reading direction.
alignAligns the popup to the start, center, or end of that side.
sideOffsetSets the gap from the anchor, in pixels.
alignOffsetShifts it along its side.
collisionPaddingLeaves space from the window's edges.

An anchor positions the popup against another element. The component's page lists the anchors it accepts.

Control Dismissal

Set [dismissible]="false" to stop Escape, outside presses, focus leaving, Back, and sheet swipes from closing it. The trigger, Close part, and controller can still close it:

import { Component } from "@angular/core"
import {
  Popover,
  PopoverClose,
  PopoverContent,
  PopoverTitle,
  PopoverTrigger,
} from "@ui-sdk/angular/popover"

@Component({
  selector: "app-project-details",
  imports: [
    Popover,
    PopoverClose,
    PopoverContent,
    PopoverTitle,
    PopoverTrigger,
  ],
  template: `
    <ng-container uiPopover [dismissible]="false">
      <button uiPopoverTrigger>Details</button>
      <div *uiPopoverContent>
        <h2 uiPopoverTitle>Project Details</h2>
        <p>Last updated today.</p>
        <button uiPopoverClose>Done</button>
      </div>
    </ng-container>
  `,
})
export class ProjectDetails {}

Listen for (dismissAttempt) to hear each refused dismissal. State and Events shows how to cancel just one reason.

Escape reaches the elements inside a popup first. One that handles the key and calls preventDefault(), like a search field clearing its text, keeps the popup open. To close it on that Escape anyway, listen for keydown on the content in the capture phase, with addEventListener and { capture: true }, before the element inside hears it, and close the popup there with its controller or open state.

Modals and Sheets

modal set to true makes the rest of the page inert and locks scrolling. Each component documents its default.

Menu, Select, Combobox, Autocomplete, Popover, and Dialog support presentation="auto" to become a sheet on small touch screens. Use presentation="sheet" to always show a sheet.

A sheet sets --available-height on its content to the room it has above the on-screen keyboard, the way a popover sets it to the room beside its trigger. So one max-height: var(--available-height) fits the content in either presentation.

Focus

Dialogs, alert dialogs, drawers, and popovers move focus into their content when they open. Where it lands depends on how they opened:

Opened WithFocus Goes To
Keyboard, screen reader, mouse, pen, or codeThe element initialFocus picks.
TouchThe content itself, so no on-screen keyboard appears, unless you set initialFocus.
HoverNowhere. Focus stays where it is.
Rendered openNowhere, except in a dialog, which takes focus as it mounts.

initialFocus defaults to "auto": the first focusable element, or the content when it has none. A dialog tries an element with autofocus first, and an alert dialog tries its first Close part. Pass "content" to focus the content itself, "none" to leave focus alone, or a CSS selector, an element, or a function that returns one. When focus lands on a text field that already holds a value, its text is selected, so typing replaces it.

modal decides whether Tab can leave. With true or "trap-focus", Tab and Shift+Tab wrap inside the content. With false, Tab moves from the trigger into a popover and on to the page after it, and focus leaving closes the popover. A non-modal dialog stays open.

When a popup closes while focus is inside it, focus returns to the trigger. If the trigger is gone or can't take focus, focus goes to the element focused before the popup opened, then where the popup it was opened from would return focus, then to the nearest focusable element after where the trigger was. A popup a controller opened returns to the element focused before it first. Set finalFocus to "none" to leave focus alone, or to a selector, an element, or a function to send it somewhere else. Closing because focus moved away never moves it back, and neither does pressing something focusable outside a non-modal popup.

Menus, selects, and comboboxes handle focus within their own lists, and tooltips never move it. Each component's page covers its own.

Mounting and Containers

With *uiPopoverContent, closed content leaves the page after its exit animation. Without the *, the content stays in the page while it's closed, hidden, and keeps its state between opens, like keepMounted does. (openChangeComplete) emits when opening or closing finishes, including animations.

Use container to render into another element, a shadow root, or an element in an iframe. Focus, Escape, and scroll locking then work in the document and shadow root the content renders in. Keep a dialog containing a form outside any surrounding form, or move its content with container, to avoid nested forms.

Styling and Animation covers transitions. For toasts and confirms, put uiOverlayHost once near your app's root; Toast and Alert Dialog show the setup.