SDK
Display modes
The formats a screen can open in on web and mobile, and how the call and the placement decide which one is used.
A screen opens in one of seven formats. Set the format on the placement in the dashboard, or in code: mode on web, style on mobile. On a phone the SDK maps each format to what feels native.
Which one is used
- The
mode(web) orstyle(mobile) from your call, if you pass one. On web, the placement's position, size and duration are then ignored too. - Otherwise the placement's format from the dashboard (web: with its position, size and duration).
- Otherwise
modalon web, a full-screen cover on mobile.
Embedded screens (Embed a screen) ignore all of this: they draw inline. On web, a format the SDK does not know (a newer one) is drawn as a modal.
Set it in code
type DisplayFormat = 'modal' | 'fullscreen' | 'banner' | 'slide_in' | 'toast' | 'drawer' | 'launcher';
type DisplayPosition = 'top' | 'bottom' | 'bottom_right' | 'bottom_left' | 'bottom_center' | 'corner' | 'left' | 'right';
type DisplaySize = 'small' | 'medium' | 'large';presentPaywall({ paywall: { placement: 'promo' }, mode: 'toast', position: 'bottom', duration: 5 });
presentPaywall({ paywall: { placement: 'promo' }, mode: 'drawer', position: 'right', size: 'large' });Formats
Dashboard / mode | Web | Mobile (style) |
|---|---|---|
Popup (modal) | Centred dialog on a dimmed page. Small 360, medium 440, large 560 px. | Full-height sheet (a form sheet on iPad) (modal). |
Full screen (fullscreen) | Covers the viewport. | Full-screen cover on iOS, full-screen activity on Android (fullscreen). |
Slide-in (slide_in) | Card near the bottom. Positions bottom_right (default), bottom_left, bottom_center. Small 320, medium 380, large 440 px. | Bottom sheet as tall as the screen's content (sheet). |
Banner (banner) | Full-width bar pinned to top (default) or bottom. | Pinned to the top or bottom edge (banner, top or bottom). |
Toast (toast) | Small note. Positions bottom (default), top, corner. Small 280, medium 360, large 440 px. | Small card at the bottom that closes itself (toast, seconds). |
Side drawer (drawer) | Panel from right (default) or left over a dimmed page. Small 360, medium 440, large 560 px. | Same as Popup. |
Launcher (launcher) | Floating button at bottom_right (default) or bottom_left that opens a screen. By hand, mode: 'launcher' opens what the launcher opens, without a button. | Same as Popup, opened by the trigger (no floating button). |
On mobile, position, size, maxContentWidth and closeOnBackdrop in the options override the placement's display, like style does:
position:toporbottomfor a banner and a toast. Other formats ignore it.size:small,mediumorlargecaps the width of a modal (360, 440, 560), a sheet (320, 380, 440) and a toast (280, 360, 440) on wide screens (tablets, landscape); the content is centered. Phones are narrower, so nothing changes there. Full screen and banner ignore it. Withoutsizein the options, the placement's size from the dashboard applies (unless you passstyle, which drops it, asmodedoes on web); a placement with no size sets no limit.maxContentWidth: a number in dp (Android) or pt (iOS) that caps the width of any format and wins oversize. The page background still fills the screen.closeOnBackdrop(defaulttrue):falsestops a tap on the dimmed area from closing a modal or sheet on Android. On iOS it makes the sheet non-dismissible by gesture, so swiping it down no longer closes it either. Back (Android) and the screen's own close button still work.
Behaviour
| Page behind | Scroll lock and focus trap | Max height | |
|---|---|---|---|
modal | Dimmed (50% black) | Yes | 100% of the viewport minus 32 px |
fullscreen | Covered | Yes | 100% of the viewport |
drawer | Dimmed (40% black) | Yes | 100% of the viewport |
banner | Usable | No | 40% of the viewport, scrolls inside |
slide_in | Usable | No | 100% of the viewport minus 32 px |
toast | Usable | No | 50% of the viewport |
- A modal, full screen or drawer moves focus in, wraps Tab, locks page scroll and gives focus back on close. A modal or drawer closes on a backdrop click unless
closeOnBackdrop: false.maxContentWidth(for example'480px') replaces a modal's width. - A banner, slide-in and toast never take focus. Esc closes them only while focus is inside.
- Under 640 px wide a slide-in becomes a bottom sheet (full width, top corners rounded, at most 85% of the viewport tall), a drawer is full width, a toast is the screen's width minus 32 px, and
cornerbecomes bottom centre. - A toast leaves after
durationseconds (default 6, 3 to 60). It waits while the pointer or focus is on it or the tab is hidden, and keeps at least 2 seconds after the visitor lets go. A toast timing out resolvesclosedand records nocloseevent. - Banner and slide-in animate over 200 ms. Animation is off for visitors who prefer reduced motion.
- Screens sit at
z-index: 2147483000; the launcher button just below. A toast isrole="status"; other formats arerole="dialog"witharia-modaltrue only for blocking ones.
The SDK adds no close button. Give the screen one with the action Close the screen.