Usage
The composable is auto‑imported in Nuxt. It combines the platform detection from the Bitrix plugin with reactive screen‑size queries.
<script setup lang="ts">
const { isBitrixMobile, screen } = useDevice()
</script>
- Platform detection is based on the
User‑Agentheader and is globally shared viauseState. - Screen‑size flags are powered by
useMediaQueryfrom VueUse, so they update reactively when the viewport changes.
On the server, screen‑size flags default to
false. Hydration will work correctly because the client values will eventually take over.API
The composable returns an object with the following properties:
Platform
Screen
The screen object contains reactive flags for every Tailwind breakpoint (xs, sm, md, lg, xl, 2xl) and a few convenience shortcuts.
Example
Basic usage – platform and mobile screen
👋 Regular web browser on a small screen.
Conditional rendering based on current breakpoint
Extra small screen (< 640px)
Using screen flags in template logic
Combine with Tailwind CSS classes
Because the plugin already adds data-platform and data-version attributes to the <html> tag, you can use Tailwind variants like bitrix-mobile: directly in your templates.
📱 This is only visible inside the Bitrix24 mobile app.
💻 This is only visible inside the Bitrix24 desktop app.
🌐 This is only visible in a regular browser.