# PopUp

> Reka-UI Dialog wrapper with a media slot and content stack. The shell behind all popup presets.

## Playground

An interactive playground for PopUp is embedded above. Open the canonical story on Storybook: [https://storybook.laioutr.cloud/?path=/story/ui-features-popup--info](https://storybook.laioutr.cloud/?path=/story/ui-features-popup--info)

## Overview

`PopUp` is the popup shell: a reka-ui Dialog wrapper with a media slot and a default content slot. It's the foundation behind the curated presets `PopUpInfo`, `PopUpNewsletter`, and `PopUpPromotion`, which render their fields into that default slot. Reach for the shell directly when none of the presets fit; otherwise use a preset.

Reka-ui Dialog semantics handle focus management and keyboard interaction.

## Layout and dismiss controls

The shell exposes the dismiss and layout knobs presets inherit:

- `closeOnEsc` (default `true`) decides whether the Escape key closes the popup.
- `closeOnOverlayClick` (default `true`) decides whether clicking the backdrop closes the popup.
- `media` renders on the leading side (top on mobile, left or right on desktop). The `media` slot lets you replace the default `<Media>` rendering with custom markup.
- `backgroundMedia` overlays a full-popup background image behind both the media slot and the content stack.
- `imagePositionDesktop` (`'left'` or `'right'`) flips desktop layout direction when media is present.
- `alignment` (`'left'` or `'center'`) sets the horizontal alignment of the content stack.
- `containerStyle` (`'boxed'` or `'full'`) controls the mobile container; on desktop the popup is always boxed and centered.
- `closeButtonVariantMobile` and `closeButtonVariantDesktop` accept any `Button` variant; the shell renders both close buttons and CSS picks one per viewport.
- `close` event fires when the user dismisses the popup (alongside `update:open`).

## Key Business & UX Benefits

- One popup shell powers every dialog on the site, so brand chrome and motion stay identical from newsletter prompt to terms notice.
- Reka-UI Dialog semantics deliver focus traps, escape handling, and ARIA roles out of the box, removing the accessibility risk that popups usually carry.
- The media slot plus content stack gives designers a clean canvas for custom popups when no preset fits.
- Builds the foundation for `PopUpInfo`, `PopUpNewsletter`, and `PopUpPromotion`, keeping one accessibility audit valid across every variant.

## Feature List

<features :items="["Reka-UI Dialog wrapper handles focus traps, escape key, and ARIA roles with no extra accessibility work","Media slot renders on the leading side (top mobile, left or right desktop) with imagePositionDesktop flipping direction","backgroundMedia overlays a full-popup image behind both the media slot and content stack for dramatic placements","Layout knobs: closeOnEsc, closeOnOverlayClick, alignment ('left' or 'center'), and containerStyle ('boxed' or 'full')","Separate closeButtonVariantMobile and closeButtonVariantDesktop let CSS pick the right close style per viewport","close event plus update:open hand dismiss handling back to the parent for analytics or persistence","Foundation behind PopUpInfo, PopUpNewsletter, and PopUpPromotion, so one accessibility audit covers every variant"]">



</features>

## API Reference

#### Props

```json
{"type":"object","properties":{"open":{"description":"Controls open state (use with v-model:open).","type":"boolean","default":false},"containerStyle":{"description":"Mobile-only container style — on desktop the pop-up is always boxed/centered.","enum":["boxed","full"],"type":"string","default":"boxed"},"alignment":{"description":"Horizontal alignment of the content stack.","enum":["left","center"],"type":"string","default":"left"},"imagePositionDesktop":{"description":"Desktop layout direction when media is present.","enum":["left","right"],"type":"string","default":"left"},"closeButtonVariantMobile":{"description":"Close button variant for mobile viewports.","enum":["primary","secondary","secondary-white","tertiary","ghost-black","ghost-white","glass-black","glass-white","positive","danger","subtle","close-black","close-white","info"],"type":"string","default":"glass-black"},"closeButtonVariantDesktop":{"description":"Close button variant for desktop viewports.","enum":["primary","secondary","secondary-white","tertiary","ghost-black","ghost-white","glass-black","glass-white","positive","danger","subtle","close-black","close-white","info"],"type":"string","default":"glass-black"},"media":{"description":"Optional media rendered on the leading side (top on mobile, left/right on desktop).","type":"object","properties":{"type":{},"sources":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string","description":"Image provider to be used with NuxtImage.\n\nIf you know the provider, e.g. `cloudinary`, `directus`, `sanity`, etc., you can use it here for optimal image-serving.\nOtherwise, the `raw` provider is a good fallback for plain URLs.\n\nAlternatively you can create a custom provider and use that here."},"src":{"type":"string"},"origin":{"type":"object","properties":{"libraryId":{"type":"string","description":"Producing library's id (the `.mediaLibrary()` registration id, default `meta.app`)."},"externalId":{"type":"string","description":"The asset's stable id within that library (Shopify gid, Shopware media UUID), when the backend has one."}},"additionalProperties":false,"required":["libraryId"],"description":"Origin of this source (producing library + stable external id)."},"width":{"type":"number"},"height":{"type":["number","undefined"]},"responsive":{"enum":["static","mobile","desktop"],"type":"string","description":"The responsiveness-mode of this source.\n- `static`: Source can be used for all viewport-sizes.\n- `mobile`: Source is a mobile-optimized version of the image.\n- `desktop`: Source is a desktop-optimized version of the image.\n\nIf not given, `static` can be assumed."},"focalPoint":{"description":"Optional focal point of the image, as fraction of the width and height of the image.\nIn form [x, y], e.g. [0.5, 0.5] for center.\n\nIf not given, center can be assumed."}},"additionalProperties":false,"required":["provider","src"]},"description":"Each source is a different version of the same image. Differences may be:\n- mobile or desktop version\n- different file-formats"},"placeholder":{"description":"Optional placeholder for the image.\n\nIf not given, the image will be loaded as is. Otherwise, the placeholder will be displayed while the image is loading."},"alt":{"type":["string","undefined"]},"meta":{},"aiDisclosure":{"enum":["generated","modified"],"type":"string","description":"AI disclosure for this asset, when the producing backend told us one.\nAbsent means no disclosure is known — there is nothing to disclose. It is\nnot an assertion that the asset is human-made.\n\nSet it only from an authoritative backend signal; never infer it from a\nfilename or guess. Omission is the correct answer for an unknown asset.\n\nDescribes the depicted content, so it is identical across every responsive\nvariant and format — which is why it lives here and not on the sources. A\nvideo's `poster` and an audio's `cover` are themselves images and carry\ntheir own, independent disclosure."}},"additionalProperties":false,"required":["type","sources"],"default":"void 0"},"backgroundMedia":{"description":"Optional full-pop-up background media (overlays media slot).","type":"object","properties":{"type":{},"sources":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string","description":"Image provider to be used with NuxtImage.\n\nIf you know the provider, e.g. `cloudinary`, `directus`, `sanity`, etc., you can use it here for optimal image-serving.\nOtherwise, the `raw` provider is a good fallback for plain URLs.\n\nAlternatively you can create a custom provider and use that here."},"src":{"type":"string"},"origin":{"type":"object","properties":{"libraryId":{"type":"string","description":"Producing library's id (the `.mediaLibrary()` registration id, default `meta.app`)."},"externalId":{"type":"string","description":"The asset's stable id within that library (Shopify gid, Shopware media UUID), when the backend has one."}},"additionalProperties":false,"required":["libraryId"],"description":"Origin of this source (producing library + stable external id)."},"width":{"type":"number"},"height":{"type":["number","undefined"]},"responsive":{"enum":["static","mobile","desktop"],"type":"string","description":"The responsiveness-mode of this source.\n- `static`: Source can be used for all viewport-sizes.\n- `mobile`: Source is a mobile-optimized version of the image.\n- `desktop`: Source is a desktop-optimized version of the image.\n\nIf not given, `static` can be assumed."},"focalPoint":{"description":"Optional focal point of the image, as fraction of the width and height of the image.\nIn form [x, y], e.g. [0.5, 0.5] for center.\n\nIf not given, center can be assumed."}},"additionalProperties":false,"required":["provider","src"]},"description":"Each source is a different version of the same image. Differences may be:\n- mobile or desktop version\n- different file-formats"},"placeholder":{"description":"Optional placeholder for the image.\n\nIf not given, the image will be loaded as is. Otherwise, the placeholder will be displayed while the image is loading."},"alt":{"type":["string","undefined"]},"meta":{},"aiDisclosure":{"enum":["generated","modified"],"type":"string","description":"AI disclosure for this asset, when the producing backend told us one.\nAbsent means no disclosure is known — there is nothing to disclose. It is\nnot an assertion that the asset is human-made.\n\nSet it only from an authoritative backend signal; never infer it from a\nfilename or guess. Omission is the correct answer for an unknown asset.\n\nDescribes the depicted content, so it is identical across every responsive\nvariant and format — which is why it lives here and not on the sources. A\nvideo's `poster` and an audio's `cover` are themselves images and carry\ntheir own, independent disclosure."}},"additionalProperties":false,"required":["type","sources"],"default":"void 0"},"closeOnEsc":{"description":"Close on Escape key.","type":"boolean","default":true},"closeOnOverlayClick":{"description":"Close when clicking the overlay.","type":"boolean","default":true}}}
```

#### Slots

```json
[{"name":"media","type":"{}","description":"","schema":{"kind":"object","type":"{}","schema":{}}},{"name":"default","type":"{}","description":"","schema":{"kind":"object","type":"{}","schema":{}}}]
```

#### Events

```json
[{"name":"close","description":"","tags":[],"type":"[]","signature":"(event: \"close\"): void","schema":[]},{"name":"update:open","description":"","tags":[],"type":"[value: boolean]","signature":"(event: \"update:open\", value: boolean): void","schema":[{"kind":"enum","type":"boolean","schema":["false","true"]}]}]
```
