Environment API
The Environment API provides access to information about the platform your app is running on. Use it to detect whether the app is embedded in the Shopify admin, running on Shopify Mobile, or running on Shopify POS.
Anchor to Use casesUse cases
- Platform detection: Determine whether your app is running on mobile, desktop, or POS.
- Responsive behavior: Adapt UI layout and features based on the current environment.
- Embedded context: Check whether the app is running in an embedded context within the Shopify admin.
- Device-specific features: Enable or disable features based on device capabilities like camera access or printing.
Anchor to Safe area insets on mobileSafe area insets on mobile
On Shopify Mobile, App Bridge automatically sets a CSS custom property, --shopify-safe-area-inset-bottom, on the document. This property provides the exact pixel value of host UI overlays such as the floating bottom navigation bar. It defaults to 0px when no overlay is present.
App Bridge also automatically adds bottom padding to the <body> element, so most apps work correctly without any changes. If your app uses custom fixed-bottom elements such as sticky footers or floating action buttons, use var(--shopify-safe-area-inset-bottom, 0px) to position them above the native floating bottom bar.
Anchor to PropertiesProperties
The environment API is available on the shopify global. All properties are synchronous booleans.
- Anchor to embeddedembeddedembeddedbooleanboolean
Whether the app is embedded in the Shopify admin.
- Anchor to intentintentintentbooleanboolean
Whether the app is running as an intent.
- Anchor to mobilemobilemobilebooleanboolean
Whether the app is running inside the Shopify Mobile app.
- Anchor to posposposbooleanboolean
Whether the app is running inside the Shopify POS app.