Skip to content

Click Outside

Primitives

A utility directive that emits when the user clicks outside the host element. Replaces per-component (document:click) handlers with a single, testable, zone-optimized implementation.

[atlasClickOutside]

Examples

Close on outside click

(atlasClickOutside) emits when a click lands outside the host element — the building block for custom panels. Selecting text that starts in the panel and ends outside does not close it. Pair it with Escape and aria-expanded so keyboard users can close the panel too.

Exclude the trigger

When the trigger sits outside the panel, pass it to [atlasClickOutsideExclude] . Otherwise a click on the trigger counts as "outside": the panel closes and the same click reopens it.

Toolbar

API

Generated from the library source, so it always matches the code.

AtlasClickOutsideDirective [atlasClickOutside]

InputTypeDefaultDescription
atlasClickOutsideExclude HTMLElement | HTMLElement[] | nullnull Optional element(s) to exclude from "outside" detection. Clicks on these elements will NOT trigger the output. Use this for trigger buttons that toggle the overlay.
OutputPayloadDescription
atlasClickOutsideMouseEvent Emits when a click occurs outside the host element (and excluded elements).