@consumidor-positivo/ts-utils - v1.34.0
    Preparing search index...

    Function IsMobile

    • Conditionally renders content based on whether the current device is mobile.

      Parameters

      • __namedParameters: IsMobileProps

      Returns ReactNode

      The appropriate content for the current device

      Renders renderIf when the device is detected as mobile, and renderElse otherwise. Device detection uses both user agent and viewport width (< 768px). Useful for rendering alternative layouts or components per form factor.

      import { IsMobile } from '@consumidor-positivo/ts-utils/react';

      <IsMobile renderIf={<MobileNav />} renderElse={<DesktopNav />} />

      // Render-only-on-mobile with no fallback
      <IsMobile renderIf={<MobileOnlyBanner />} />