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
Conditional rendering based on current breakpoint
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.